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..


There are two ways of doing this either by using an update handles, which will essentially add a complete layout handle inside another one.

    <!-- add your blocks -->

Then on each controller handle you can use this handle.

    <update handle="your_default_handle" />
    <!-- make any changes that you need -->

The other option is to add the handle in your controller. This can be done via the following code:

$update = $this->getLayout()->getUpdate();

Yes there is.
Create your own handle that looks like this.

    <!-- blocks go here -->

Now you can include your handle in the handle of your action:

    <update handle="my_handle" />
    <!-- additional blocks go here if you need them -->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.