O'Reilly logo

Magento 1.4 Development Cookbook by Nurul Ferdous

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding required blocks for the News module

Blocks are Magento's important parts, which is a defined part of the screen. The full page is divided into several blocks to allow the granularity in Magento CMS. In every module, blocks are an inevitable part. In this recipe, we will create some blocks that will help present data for our News module.

How to do it...

  1. Open your PHP IDE and create a new PHP file in app/code/local/Packt/News/Block/News.php.
  2. Replace the existing code with the following code:
    <?php class Packt_News_Block_News extends Mage_Core_Block_Template { public function _prepareLayout() { return parent::_prepareLayout(); } public function getNews() { if (!$this->hasData('news')) { $this->setData('news', Mage::registry('news')); } return ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required