1

I'm still pretty new to Magento (1.9 EE) so some of my terminology may be incorrect, apologies if so.

Anyway, in one of my layout XML files, I have a custom block which I can include using the update tag, something like

<custom_block>
    <block name="...">
        ...
    </block>
</custom_block>

<another_block_1>
    <update handle="custom_block" />
</another_block_1>

This all works fine. However, when I try to call the update from within a block tag, it doesn't work, something like:

<another_block_2>
    <block name="sub_another_block_2" ...>
        <update handle="custom_block" />
    </block>
</another_block_2>

Is what I'm trying to do possible? A colleague mentioned that update might not be the correct tag.

2
  • Is there anything specific you're trying to update? If you put this question in context we might be able to help you. E.g what you're trying to achieve. Commented Dec 14, 2016 at 14:53
  • Thanks @AndréFerraz . I'm basically trying to have a re-usable block in my layout. So, custom_block above will be used twice in the same layout: once in the first/working format another_block_1, then the second time, I need it within the sub_another_block_2 section, which is part of another_block_2. Hope that makes sense! (I edited the original text to add _1 and _2 to another_block, for clarity)
    – eclipse31
    Commented Dec 14, 2016 at 15:00

1 Answer 1

0

The only meaningful occurrence o update and handle I found is in the Layout update class.
What this method does, is to parse the merged layout handle and if it finds child nodes with the name update and the attribute handle it merges that handle to the current handle.
As you can see it only looks for update nodes as direct child nodes of the main handle tag. It does not look for it inside the blocks or any other tags you might have.
In conclusion, no, adding update handles inside blocks does not work.

0

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.