小编Han*_*ter的帖子

在Controller中添加新块并将其设置在第一个位置

我在我的控制器中添加了一个新块,这是有效的.

$this->loadLayout();
$cmsBlock = $this->getLayout()->createBlock('cms/block')->setBlockId('cms_block_fail');
$this->getLayout()->getBlock('content')->append($cmsBlock);
$this->renderLayout();
Run Code Online (Sandbox Code Playgroud)

在Layout.xml中,我在"content"structurblock中设置了另一个内容块.

<reference name="content">
    <block type="contactus/form" name="contact_us" template="contactus/contactus.phtml"/> 
</reference>
Run Code Online (Sandbox Code Playgroud)

我想要块之前的CMS contact_us块.在Layout.xml我可以使用前后的参数.如果我写after="-"的块将被设置在结构块"内容"的最后位置,那是对的吗?这不起作用.如何php在Controller中设置此参数?还是其他想法?

position block magento

2
推荐指数
1
解决办法
3383
查看次数

标签 统计

block ×1

magento ×1

position ×1