Magento - createBlock() in controller, can I access this in layout.xml?
- by pspahn
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>