如何在cms页面中调用phtml文件来设置页面标题

sam*_*am 4 php magento

在Magento如何调用cms页面中的phtml文件来设置我在我的phtml文件中设置的页面标题?我在用

$this->getLayout()->getBlock('head')->setTitle('your title'); 
Run Code Online (Sandbox Code Playgroud)

设置页面标题.

小智 9

要在cms页面或cms静态块中调用phtml文件:

{{block type="core/template" template="templateFolder/your_template.phtml"}}
Run Code Online (Sandbox Code Playgroud)

如果您知道,phtml文件的块文件(php文件)所在的位置,则可以将其用作类型.

示例:假设您要调用驻留在catalog/product文件夹中的new.phtml文件,并且您知道其对应的Block文件(php文件)位于Catalog/Product文件夹中,那么您可以使用:

{{block type="catalog/product" template="catalog/product/new.phtml"}}
Run Code Online (Sandbox Code Playgroud)

更多阅读:这里

希望这可以帮助!