I am using Magnolia CMS 5.4 and I want to build a module that will render some content of a page and expose it over REST API. The task is simple but not sure how to approach it and/or where to start.
I want my module to generate partial template or an area of a template for a given reference, let’s say that is “header”. I need to render the header template/area get the HTML and return that as a response to another system.
First thing the rendering works based on different renderers and those could be JCR, plain text or Freemarker renderer. In Magnolia those are decided and used in RenderingEngine and the implementation: DefaultRenderingEngine. The rendering engine will allow you to render a whole page node which is one step closer to what I am trying to achieve. So let’s see how could this be done:
Read more ›
Laravel is great framework and I quite enjoy how it’s structured and how it works. In version 4 it was migrated from bundles to using Composer for dependency injection which is great and fits well in my daily routine on building apps also follows standards promoted by the PHP community in general.
In my application I was planning to add MongoDB support as first I’d like to improve the performance and second my data structure is perfect for this purpose, furthermore I want to improve my NoSQL skillset.
In this article I’ll describe the steps that I followed on installing the MongoDB provider, the problems that I’ve faced and final solutions and small tricks I used to make all work. Read more ›
I use BASH aliases extensively throughout my DEV environments and it saves me a lot of time. One specific I use is “cdv” that’s shorthand for CD to VirtualHosts which in most cases could be as simple as /var/www or in some cases could be very long path, especially on shared DEV environments like /var/www/dev/vhosts/mylongusername. Read more ›
Every now and then I am asked by different clients if I can export specific customer data, most often people need emails of their customers to use for newsletters or other types of marketing campaigns. There are two different ways to approach the problem either get all orders and get the customer email or any other related details that might be needed or you can use the customer collection which will give you all unique records for customers.
Setup magento API access
Read more ›
Custom error handler for Laravel
I build API service for a mobile application and I faced a problem with the error reporting with Laravel.
Laravel is awesome framework and is great for RESTful application or building API that’s why it’s my first choice.
But I had one problem, my API should produce only JSON and my application can consume only JSON. So HTML error pages are pointless and needless for me. I had a specific case where a PHP error was causing problems but I also wanted to handle all PHP and display them appropriately for my app. Here is the solution: Read more ›
Consistent dates in PHP
It’s really interesting how small changes in core PHP functionality could break whole website and take hours to find the cause of the bug.
I am building website which takes some use of dates, stored in MySQL database as Date format for simplicity
Those dates are optional fields in my application and sometimes they have Zero Date format: ‘0000-00-00‘ which works perfectly on my development environment. Locally I am using PHP 5.3.4 not latest but allows me to spot any backward compatibility issues and probably it’s more laziness for not upgrading than any other sophisticated reason. Anyhow on production I run PHP 5.3.24 and so far everything has been just OK, running smoothly with no issues.
Read more ›
Posted in PHP
Tagged with: DateTime
, Zero dates
In this quick tip I’ll show you how to install the PHP extensionmcrypt. This is needed for Magento to run properly otherwise you’ll get an error like:
[cc type=”text” escaped=”true”]Fatal error: Call to undefined function mcrypt_create_iv() in lib/Varien/Crypt/Mcrypt.php on line 64[/cc]
Read more ›
I had a problem with client’s data that was saved as HTML in the database and I needed it in plain format. Many would say this is very inefficient way of doing it but sometimes desperate time call for desperate measures. And here is my solution to the problem: Read more ›
Posted in Small Tips
Tagged with: html
Magento is one of the fastest growing eCommerce platforms on the internet and with its recent acquisition by eBay it promises to stay on the lead and keep growing with even faster pace than before. It’s been choice for a platform for many of my clients and recently I had to do some development work on one of the websites. The shop was running Magento 1.7 and was on a dedicated CentOS server.
Move Magento to different domain/subdomain
Read more ›
If you forget your admin password for Magento and you can’t remember the email or just want quick fix you can use one line of SQL to sort that issue out.
[cc lang=”sql”]UPDATE admin_user SET password=CONCAT(MD5(‘qXpassword’), ‘:qX’) WHERE username=’admin’;[/cc]
All you have to do is replace the “password” with your required one and run the query.