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;