How to transfer data from Controller to View Magento ?

March 18, 2018

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.

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.

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



Karan Suthar

Surat, India

I'm Karan, the creator Behind the KTechBlog. I write Blogs in my Free Time. I ❤ to learn new Technologies and Share with Others. I'm Trying best effort to make KTechBlog useful for Everyone.