I would like to know how I can display custom code in a CMS page. When using static blocks I can use the following code:

{{block type="cms/block" block_id="customcode"}}

I guess it has to be something like this:

{{block type="core/template" template="custom/code.phtml"}}

Does it work like that? Where do I put the file custom/code.phtml?

1 Answer 1


Let me give you an example, if you want to define a homepage for your website, all you'll have to do is create a CMS page called "home" (original right?) and add {{block type="core/template" template="page/html/home.phtml"}} to its content.
Then go to System > Configuration >General > Web > Default Page and there, select your freshly created home page, hit save.

It won't work, because that template (.phtml) file doesn't exist yet.
Go to your template folder (in your theme if you have one) and under /template/page/html create a file called home.phtml

In that file just wite <?php echo 'Hello world!' ?>. Refresh your website and you should see the message on the Homepage.

  • Thanks! I knew I had done this before, but was looking in the code-folder, not the theme itself.
    – SPRBRN
    Commented Jun 11, 2014 at 15:21
  • Glad that helped ;) Commented Jun 11, 2014 at 15:29

Your Answer

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

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