0

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

2 Answers 2

0

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');
0

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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