I was creating 4-5 controllers, all of which would use the same template-block files
so, was wondering if there was a way to assign same template-block without changing the the handles, i.e without copy pasting the same thing for all the handles..
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
There are two ways of doing this either by using an update handles, which will essentially add a complete layout handle inside another one.
<your_default_handle> <!-- add your blocks --> </your_default_handle>
Then on each controller handle you can use this handle.
<controller_handle> <update handle="your_default_handle" /> <!-- make any changes that you need --> </controller_handle>
The other option is to add the handle in your controller. This can be done via the following code:
$update = $this->getLayout()->getUpdate(); $update->addHandle('your_default_handle');
Yes there is.
Create your own handle that looks like this.
<my_handle> <!-- blocks go here --> </my_handle>
Now you can include your handle in the handle of your action:
<module_controller_action> <update handle="my_handle" /> <!-- additional blocks go here if you need them --> <module_controller_action>