Reputation: 147
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?
Upvotes: 3
Views: 1913
Reputation: 2553
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
, not cms/block
.
Upvotes: 4
Reputation: 3694
If you want to just display your template file, you should use block type core/template
for that. Try this xml:
<reference name="head">
<block type="core/template" template="myfolder/mytemplate.phtml"/>
</reference>
Upvotes: 1