I am new to Magento and so sorry for the noddy question.

I am trying to add php to a CMS page and the way to do this appears to be to put the php (including Mage calls) to a phtml template and then add it to the CMS page with {{block type="core/template" template="template.phtml"}}.

But, in all the examples that I can find saying that this is the way to do it none of them tell me where to put the phtml file so I can use the above.

So my question is; where do I put a template to call using {{block type="core/template" template="template.phtml"}}?

Thanks in advance, Norman

3 Answers 3


The template file is relative to your theme's template folder. But also taking into consideration the template fallback (see this for more details) you have 2 options:

  1. add the template file in your current theme:

  2. add the template file in the base package:


Then, in your CMS page you will add {{block type="core/template" template="[CUSTOM_FOLDER]/[TEMPLATE].phtml"}}

Where [YOUR_PACKAGE] and [YOUR_THEME] are the currently used package and theme folders used on your store, and [CUSTOM_FOLDER] and [TEMPLATE] can be anything on your choice

  • alex.ayg and @Joshua43com - Thank you both for your replays. While working through what you have advised (even though I was sure I had tried this) I have realised that the reason that it was not working was that I had not clicked 'Hide Editor' before I had typed it. What you have advised has worked so thank you. Sorry for being such a fool. :)
    – Norman_SK
    Sep 14, 2014 at 1:11

Welcome to Magento SE.

An easy way to make this call from a static block is, add this to your static block:

{{block type="core/template" template="page/template.phtml"}}

Place page.phtml at this path, with your custom code:


If you are still having problems, due to Magento's hierarchy, you can also place it here:


Be sure to flush your cache


I try to do the same:

I created a file mycms.phtml in this folder:


On the static page content/pages/mycmspage I added this line

{{block type="core/template" template="cms/mycms.phtml"}}

the testfile mycms.phtml only contains

<?php echo "test php"; ?>

This is not working for me?

also when placing the file here:


My theme is a child theme of luma

is not working?

please advice

  • I use magento 2.3.1
    – goodlook
    Jun 1, 2019 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.