magento怎么在CMS page中使用php code

WBOY
Release: 2016-06-13 11:19:34
Original
992 people have browsed it

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

app/design/frontend/default/yourtheme/template/page/page.phtml
Copy after login

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

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!