How to transfer data from Controller to View Magento ?

Hello Developer,

today we are Learn How to transfer data from Controller to View Magento.

Magento have a inbuilt function to pass array from controller to Phtml file. You can Pass any Data Like a Array String using this Method.

First You have to Store a Value in one variable.

$cars = array("Volvo", "BMW", "Toyota");

Its You array You want to pass a result in phtml file from controller Magento. then You can use Mage::register method to pass array in controller.

Now Set this value in Your Controller.


In this line the cars_data name is only name to access the data in phtml file. You can writer here any name as per Your Choice.

Now Get Data in Your View Phtml File.

$car_value = Mage::registry('cars_data');

Now You Can Store the data in a Variable and you can Check the getting data using var_dump($car_value );



One thought on “How to transfer data from Controller to View Magento ?

  1. Hey webmaster
    When you write some blogs and share with us,that is a hard work for you but share makes you happly right?
    yes I am a blogger too,and I wanna share with you my method to make some extra cash,not too much
    maybe $100 a day,but when you keep up the work,the cash will come in much and more.more info you can checkout my blog.
    good luck and cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *