页面Layout xml配置
<referenceContainer name="content">
<block class="Silk\CatalogWidgetHome\Block\Product\ProductsList" name="home.banner" template="Magento_Cms::home_need.phtml" before="-">
<arguments>
<argument name="one_id" xsi:type="number">2882</argument>
<argument name="two_id" xsi:type="number">2883</argument>
</arguments>
<block class="Silk\Cms\Block\Product" name="aaa" template="Magento_Cms::home_need_countDown.phtml"/>
</block>
</referenceContainer>
在对应的home_need.phtml里获取arguments参数:
<?php
$itemId1 = empty($block->getOneId()) ? 2882 : $block->getOneId();
$itemId2 = empty($block->getTwoId()) ? 2883 : $block->getTwoId();
?>
来源:oschina
链接:https://my.oschina.net/ganfanghua/blog/3222855