I have the homepage all laid out in the Admin > CMS. The homepage includes a PHP RSS viewer. But when I got to the live site, it just displays text, and does not run the PHP script.
You’ll need to create a block (ex. Mage_Brady_Block_Rss) with this functionality implemented in toHtml() method and call it from CMS page as:
{{block type="brady/rss"}}
Ok, I created a new file: app > code > core > Mage > Brady > Block > Rss.php which includes my PHP RSS Parser and placed the {{block type="brady/rss"}} code in my homepage code.
When I visit the homepage, the RSS does parse, but the rest of the homepage does now show up, and I receive the error:
Fatal error: Class 'Mage_Brady_Block_Rss' not found in /homepages/2/d212266666/htdocs/store/app/code/core/Mage/Core/Model/Layout.php on line 309
Try this shortcut to test your PHP code, but note that to share this functionality you will need to create a module, with example as in wiki article about creation of payment module:
class Mage_Brady_Block_Rss extends Mage_Core_Block_Abstract { public function toHtml() { // create your html here and assign to $html variable return $html; } }
Put this in your local.xml:
<!-- add this --> <blocks> <brady> <class>Mage_Brady_Block</class> </brady> </blocks> <!-- right before the end -->
</global> </config>
Now you can use it in CMS pages as {{block type="brady/rss"}}
Again, please note that this is not correct way of creating a module, but as a test for custom block should work.