我如何在magento的特定页面调用.phtml块? [英] How do i call .phtml block at specfic page in magento?

查看:58
本文介绍了我如何在magento的特定页面调用.phtml块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何在测试页上使用test.phtml我使用了以下代码,但没有用

How do i use test.phtml at test page i used following code but it didnt work

{{block type='core/template' name='Test' template='goodtest/test.phtml'}} 

但是它没有在页面上显示任何内容.那我错过了什么吗?我是否需要在其他文件中放入一些代码,例如page.xml或local.xml.

But it didnt show anything at the page. So did i missed anything? do i need to put some code in other files, like page.xml or local.xml.

谢谢

推荐答案

您的代码很适合在CMS页面中添加. 如果要在.phtml文件中添加.phtml文件,则可以这样使用. 您不需要在xml文件中添加任何内容

your code looks good for to add in CMS page. if you want to add .phtml file in a .phtml file then you can use like this. you don't need to add anything in xml file

    <?php 
  echo $this->getLayout()->createBlock('core/template')->setTemplate('goodtest/test.phtml')->toHtml();
?>

谢谢

这篇关于我如何在magento的特定页面调用.phtml块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆