Home  >  Article  >  Backend Development  >  magento怎么在CMS page中使用php code

magento怎么在CMS page中使用php code

WBOY
WBOYOriginal
2016-06-13 12:49:57939browse

magento如何在CMS page中使用php code
通常我们创建一个cms page之后,在后台可以借助magento自带的编辑器进行一些简单的变量插入,但是如果页面内容比较复杂并且有很多自定义变量的时候,比如我们需要从db取一些数据或者对数据进行复杂处理时,自带的编辑器就无能为力了;一个比较好的方法就是创建自己的phtml,例如创建page.phtml:

app/design/frontend/default/yourtheme/template/page/page.phtml

然后在后台cms page的content里合适位置写入以下内容:
{{block type="core/template" template="page/page.phtml"}}

这样一些复杂的处理就可以在page.phtml中使用php code进行处理了。

PS:比如你可以在home page 中任意位置加入自定义的phtml;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn