Mike
Mike

Reputation: 138

CMS block doesn't appear although called in template (Magento)

I have tried to add a static CMS block inside a template. Here's what I've used

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('gift')->toHtml() ?>

But then, when I clear the cache and also, delete all files in var/cache folder, this block doesn't appear on the page.

I looked into the database and saw the correct relationship between block id and store id. This block is also active.

What should I do to make this block appear on a page? Is there anything else I need to look further into?

Thank you very much.

Upvotes: 2

Views: 850

Answers (2)

Check if you have a relation between the CMS Static Block and the store in the database table cms_block_store

Upvotes: 0

Zachary Schuessler
Zachary Schuessler

Reputation: 3682

Your syntax is correct.

  1. Check that the identifier you set on your static block is 'gift'
  2. Verify that $this->getLayout() is working correctly. Namely, make sure you are using the code on a template file.
  3. Verify your static block has content.
  4. If all else fails, enable logging and check error log. Enable template/path hints and check those.

Upvotes: 1

Related Questions