Include phtml in magento CMS
Pergunta
I'm trying to make different page where i need PHP. thats why i use a phtml file. I don't want to make any changes to the other Magento layouts so I just want to include the phtml file via the CMS.
I've made a phtml file in: mycustomtemplate/template/page/page.phtml
that file contains just 'test'.
then I've tried to call in the magento CMS->new page->content tab with:
{{block type="core/template" template="page/page.phtml"}}
but nothing shows up. Is there any way to do this? And how..
Solução
The syntax is correct, so the issue is theme misconfiguration or the "Test" output is being hidden in the browser. View source and confirm that the latter is not the case.
Try creating a copy of the file at frontend/base/default/template/page/page.phtml
as this template location has to work - if the content appears, the issue is theme misconfiguration.
Outras dicas
It depends on what version of Magento you're running if you're trying to place the file in the base template - make sure that you're not placing the file in the (now deprecated) default/default path:
Pre 1.4CE/1.8EE:
frontend/default/default/template/page/page.phtml
After 1.4CE/1.8EE:
frontend/base/default/template/page/page.phtml
Some extra reading on theme hierarchy from the Magento KB:
http://www.magentocommerce.com/knowledge-base/entry/magentos-theme-hierarchy#3.2
Your solution is correct (I've just tested it). Make sure you created your template file in the correct directory. It should be placed here:
app/design/frontend/[package]/[theme]/template/page/page.phtml
And flush Magento cache.
You are heading towards right direction. Cache refresh, already purposed, additionally, turn on the magento development mode to make sure your block has been added to the page.