Where Do I Put a Template To Add Using {{block type="core/template" template="template.phtml"}}

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


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

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

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

Tags: Template / Cms

Similar questions

Put pager.html inside result.phtml instead of toolbar.phtml
I'm trying to put a pagination on my result.phtml file using pager.phtml file creating a custom block: But i get the following error: On Magento's default structure, the function $this->getPagerHtml() is used inside the file toolbar.phtml: This function shows the default page navigation and the toolbar.phtml file is called on: by the function $this...
Call block of type core/text_list inside Static Block or CMS Page
Is there any way or work-around for getting the content of "core/text_list" type block into CMS Homepage, with least possible changes ? The "core/text_list" type block contains two banner sliders one wide banner and another narrow banner slider. It is defined in the local.xml file of custom theme like below: I want to call that block of type "core/...
How to fix the error “Notice: Undefined variable : block in app/code/core/Mage/Core/Model/Email/Template/Filter.php”
After I have installed the following patches: SUPEE-6285-1.9.1v2, SUPEE-6482-, SUPEE-6788-, SUPEE-7405-, my system.log file is filled with full of the following errors: Notice: Undefined variable: block in app/code/core/Mage/Core/Model/Email/Template/Filter.php on line 187 Notice: Undefined variable: block in app/code/core/Mage...
PHP Fatal error: Uncaught Error: Cannot re-assign $this in ../app/code/core/Mage/Core/Block/Template.php with PHP 7.1
I'm using magento C.E. and PHP 7.1 and I get the following error when I visit a category page: This error happens here (Line 215): This is due to dynamic calls being forbidden in PHP 7.1 Does anyone knows of a fix for this?
M2/ How to fix "Incompatible argument type: Required type: string. Actual type ..."
A compilation was started. Interception cache generation... 6/7 [========================>---] 85% 1 min 404.0 MiB Errors during compilation: SkyFox\Supplier\UI\DataProvider\Supplier\DataProvider Incompatible argument type: Required type: string. Actual type:\SkyFox\Supplier\UI\DataProvider\Supplier\name; File: /var/www/html/sky.local/app/code/SkyF...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.