我在主页上安装了滑块扩展程序。它给了我一个静态块代码。
Call via block:
{{block type="responsivebannerslider/index" name="responsivebannerslider_index" template="responsivebannerslider/index.phtml"}}
不知道如何在.phtml文件中调用它?
答案 0 :(得分:2)
您可以直接在phtml模板文件中在布局上创建一个块,从模板中调用它:
<?php echo $this->getLayout()->createBlock('responsivebannerslider/index')->setTemplate('responsivebannerslider/index.phtml')->toHtml(); ?>
或者如果块列在扩展布局XML文件中(它将嵌套在引用节点中),并且看起来像:
<block type="responsivebannerslider/index" name="responsivebannerslider_index" as="an_alias" template="responsivebannerslider/index.phtml">
<label>Responsive banner</label>
</block>
您可以在模板文件中将其称为:
<?php echo $this->getChildHtml('an_alias'); ?>
答案 1 :(得分:1)
<?php echo $this->getLayout()->createBlock('responsivebannerslider/index')->setTemplate('responsivebannerslider/index.phtml')->toHtml(); ?>
&#13;