A client called us yesterday evening and told us that he was getting a blank page when switching to a Gantry template. He told us that his website worked normally under a regular template, but, as soon as he switched to a Gantry template, he was seeing a blank page.
Before going into the details, we would like to express our opinion about Gantry templates, we don’t like them much – we don’t hate them but we don’t like them much. The level of abstraction they add to the templates is ridicilous, and it makes debugging anything a nightmare.
Now, going back to the real issue, it was very easy for us to reproduce the error, all we needed to do was to switch to a Gantry template. We immediately started debugging the issue, and we found that the problem started with the following line in the index.php file located under the templates/[gantry-template-name] folder:
<?php echo $gantry->displayMainbody(‘mainbody’,’sidebar’,’standard’,’standard’,’standard’,’standard’,’standard’); ?>
Naturally, we searched for the function displayMainbody, and we found it in the gantry.class.php file under the /libraries/gantry/core folder. The problematic line in that function was a call to the static method display on the GantryMainBodyRenderer class. That method was defined in the file gantrymainbodyrenderer.class.php in the folder /libraries/gantry/core/renderers.
We finally narrowed down the problem to the function $gantry->renderLayout, which is responsible for rendering modules. And then it struck us, it was a rogue module that was causing this problem. That module was only being used by the Gantry template and not by other templates. So, in order to know which module it was, we added the following lines to show all the errors:
error_reporting(E_ALL);
ini_set('display_errors', '1');
That allowed us to see the real error, it was this one:
Fatal error: Call to undefined method JDate::toMySQL() in /home/[website-user]/public_html/modules/mod_mt_listing/helper.php on line 126
The error was obviously in a Mosets Tree module (which is not a great extension by all accounts). Fixing the error consisted of simply changing all occurrences from JDate::toMySQL to JDate::toSQL . That was it!
So, the next time you’re seeing a blank page when you’re using a Gantry Template (on the frontend, we’ve discussed the same issue on the backend before), then most likely this is a module. Try disabling the published modules, one by one, until the problem is resolved.
If you really need the problematic module, and you need help fixing it (rather than just disabling it), then please contact us. We have fixed so many extensions and we’re sure we’ll be able to fix yours (even if it’s home-made). Our work is extremely fast and clean, our prices are right, and our target is to keep you as a long term happy customer!