【发布时间】:2013-04-22 11:14:30
【问题描述】:
我正在尝试创建一个自定义页面,我使用空模板为其提供以下 XML。
在我的控制器中,我有
public function indexAction()
{
$this->loadLayout();
$this->getLayout()->getBlock('root')->setTemplate('page/empty.phtml');
$this->renderLayout();
}
在我的布局中,我有
<?xml version="1.0"?>
<layout version="0.1.0">
<brands_index_index>
<reference name="content">
<block type="catalog/layer_view" name="catalog.leftnav" before="brands" template="catalog/layer/view.phtml"/>
<block type="core/template" name="brands" template="brands/brands.phtml" />
</reference>
</brands_index_index>
</layout>
这很好用,并且显示了分层导航。
但是,我希望在brands.phtml 模板中显示分层导航。 因此,我尝试执行以下操作:
<?xml version="1.0"?>
<layout version="0.1.0">
<brands_index_index>
<reference name="content">
<block type="core/template" name="brands" template="brands/brands.phtml" >
<block type="catalog/layer_view" name="catalog.leftnav" as="catalog.leftnav" template="catalog/layer/view.phtml"/>
</block>
</reference>
</brands_index_index>
</layout>
但是,当我在brands.phtml 中调用getChildHtml("catalog.leftnav") 时,这似乎不起作用。
如何将分层导航转移到我需要在brands.phtml 中调用它的位置?
因此,当我查看“Magento 调试”中的“渲染块”部分时,似乎加载了该块。但是,没有生成任何 HTML。有没有规定分层导航必须在左/内容/右块中?
谢谢
【问题讨论】:
标签: magento magento-layout-xml