How does magento use phpcode in CMSpage?

Source: Internet
Author: User
Magento: how to use phpcode in CMSpage. after creating a cmspage, you can use the magento editor in the background to insert some simple variables, however, if the page content is complex and there are many custom variables, for example, when we need to retrieve some data from the db or perform complex processing on the data, the built-in editor shows how magento uses php code in CMS page.
After creating a cms page, you can use the magento editor in the background to insert some simple variables. However, if the page content is complex and there are many custom variables, for example, when we need to extract some data from the database or perform complex processing on the data, the built-in editor is powerless. a better method is to create your own phtml, such as creating a page. phtml:
App/design/frontend/default/yourtheme/template/page. phtml

Then, write the following content in the content of the cms page in the background:
{Block type = "core/template" template = "page/page. phtml "}}

In this way, you can use php code in page. phtml to process complicated processing.

PS: for example, you can add a custom phtml to any location on the home page;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.