Book Image

Magento PHP Developer????s Guide, 2nd Edition

By : Allan MacGregor
Book Image

Magento PHP Developer????s Guide, 2nd Edition

By: Allan MacGregor

Overview of this book

Table of Contents (16 chapters)
Magento PHP Developer's Guide Second Edition
About the Author
About the Reviewers

The controller

At its core, Magento is a Model-View-Controller (MVC) framework, so in order to make our new route functional, we have to create a new controller that will respond to this specific route. To do this, perform the following steps:

  1. Navigate to the extension root directory.

  2. Create a new folder called controllers.

  3. Inside the controllers folder create a file called IndexController.php.

  4. Copy the following code:

    The file location is app/code/local/Mdg/Hello/controllers/IndexController.php.

    class Mdg_Hello_IndexController extends Mage_Core_Controller_Front_Action
         public function indexAction()
         echo 'Hello World this is the default action';