Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Static block won’t work
 
sean69
Jr. Member
 
Total Posts:  21
Joined:  2007-11-29
 

anyone know why this does not work?

{{block type="cms/block" block_id="block_test" template="cms/custom-content.phtml"}}

I have a block “block_test” defined, if I go to the cms page the above line is in I get that block shown, but what is not working is the cms/custom-content.phtml ....  I can’t even edit cms/content.phtml and get it to show changes.

- frustrated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BullfrogChamps
Member
 
Total Posts:  31
Joined:  2009-05-17
Melbourne, Australia
 

OK, so I think the issue is that you are trying to make the {{block ...}} CMS tag do two things at once.

There are two different ways that the tag works.  If you do

{{block id="some-block-id"}}
then the static block with the id some-block-id will be inserted.  The second way looks something like
{{block type="core/template" template="path/to/some/template.phtml"}}
In this form, the template block at path/to/some/template.phtml is inserted, and it’s type is core/template.

As far as I can see, you’re trying to compare both of these methods in one tag, and the type/template form is taking precedence.  I think that perhaps a better solution will be to include the static block reference from inside your template file.  So, make the block tag look like this:

{{block type="core/template" template="cms/custom-content.phtml"}}
Then, in that file, add the following line wherever you want your static block content to be:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_test')->toHtml() ?>

Then, it should all work the way you want it!

Let me know how you go..

Jeremy.

P.S.  I personally find http://www.magentocommerce.com/wiki/markup_tags quite useful for the different tags you can use in your CMS areas, and I find http://www.fontis.com.au/blog/magento/cms-static-blocks a very useful guide for using and inserting static blocks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
BullfrogChamps
Member
 
Total Posts:  31
Joined:  2009-05-17
Melbourne, Australia
 

Oooops, sorry, double-post.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sean69
Jr. Member
 
Total Posts:  21
Joined:  2007-11-29
 

thank you - works perfectly.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top