Magento - createBlock() in controller, can I access this in layout.xml?

Posted by pspahn on Stack Overflow See other posts from Stack Overflow or by pspahn
Published on 2012-10-25T16:50:11Z Indexed on 2012/10/25 17:00 UTC
Read the original article Hit count: 119

Filed under:
|

I have an index controller with a view action that does the following:

echo $this->getLayout()
    ->createBlock('core/template','builder')
    ->setTemplate('pages/builder/view.phtml')
    ->setHeaderText($extra->getHeaderText())
    ->setFooterText($extra->getFooterText())
    ->setProducts($collection)
    ->toHtml();

Based on this, I am trying to perform layout updates in builder.xml (which is being set in the module's config.xml). However, I am not sure if you can target blocks instantiated in this manner. Based on the above block creation, am I able to perform the following:

<layout version="0.1.0">
    <builder_index_view>
        <!-- shouldn't this reference the createBlock() name argument? -->
        <reference name="builder">
            <block type="page/html_header" name="builder.header" as="builder.header" template="pages/builder/header.phtml"/>
        </reference>
    </builder_index_view>
</layout>

© Stack Overflow or respective owner

Related posts about magento

Related posts about layout