如何在Magento 2中的任何地方显示静态块



我已经在Magento 2 Admin面板中创建了块。块标识符是" contact-us-info"。我正在使用以下代码在我的Magento网站中显示该块,但不运气。

<block class="MagentoCmsBlockBlock" name="contact-us-info">
                <arguments>
                    <argument name="contact-us-info" xsi:type="string">contact-us-info</argument>
                </arguments>
            </block>

请帮助我。

预先感谢

在phtml文件中:

<?php echo $block->getLayout()->createBlock('MagentoCmsBlockBlock')->setBlockId('block_identifier')->toHtml();?>

在CMS内容中:

{{block class="Magento\Cms\Block\Block" block_id="block_identifier"}}

最新更新