Question

I have a strange issue where any page load attempts simply outputs a string of PHP code. When inspecting the source code, it reveals that it's actually the entire content of a class file as shown below. This happens on a particular server and for any page request.

The same code base and database works fine on my local environment. Any idea what might be doing this?

Page doesn't load

Was it helpful?

Solution

Looking at your code, the first thing that pops out is you're using a PHP short tag to start your PHP file

`<?`

You'll want to change that to

`<?php`

My guess if your server is setup with the short_open_tag ini set to false, which means <? will be interpreted as a regular bit of text.

OTHER TIPS

Something about this old question just jumped out to me - in your screenshot you have created a Block which extends the Mage_Core_Block_Template class.

However, your block methods are named as actions, indicating that this may be controller code. Further, you're using loadLayout and renderLayout - both are methods that come from the Mage_Core_Controller_Varien_Action - again, controller code.

I believe that besides PHP short tags you likely have other issues here.

Hope that helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top