I added a new CMS page, and editted the Layout XML to show this:
<reference name="head">
<block type="cms/block" name="myblock" template="myfolder/mytemplate.phtml"></block>
</reference>
So I put the file “mytemplate.phtml” in this folder:
/app/design/frontend/base/default/template/myfolder
And I put this test script in the file:
<?php
echo '<script>alert("hello");</script>';
?>
However, when I load the CMS page nothing happens, so it means the ‘mytemplate.phtml’ file is not loading.
How can I make this work?
If you’re going to use template (phtml), your block should extend from
Mage_Core_Block_Template.So your block type should be
core/template, notcms/block.