如何在cms页面中调用phtml文件以设置页面标题 [英] How to call a phtml file in cms page to set page title

查看:75
本文介绍了如何在cms页面中调用phtml文件以设置页面标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In Magento how to call a phtml file in cms page to set page title which title I set in my phtml file? I am using

$this->getLayout()->getBlock('head')->setTitle('your title'); 

设置页面标题.

推荐答案

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

To call a phtml file in a cms page or cms static block:

{{block type="core/template" template="templateFolder/your_template.phtml"}}

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

If you know, where the block file(php file) for your phtml file resides, then you can use it as type.

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

Example: Suppose you want to call new.phtml file that resides in catalog/product folder, and you know that its corresponding Block file(php file) resides in Catalog/Product folder, then you can use:

{{block type="catalog/product" template="catalog/product/new.phtml"}}

更多阅读:此处

希望这会有所帮助!

这篇关于如何在cms页面中调用phtml文件以设置页面标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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