Magento: CMS Block im Template ausgeben

Bei Magento gibt es mehrere Möglichkeiten Blöcke anzulegen. Die einfachste Möglichkeit besteht darin, dass man die Blöcke direkt im integrierten CMS anlegt. Dadurch verliert man zwar die Möglichkeit in den Blöcken Code auszuführen, allerdings dürften bestehen viele Blöcke sowieso nur aus statischen Inhalten.

Statische Blöcke einbinden

Am saubersten erfolgt die Einbindung in den Layout-XML Dateien:




 
 block_id
 
 
 

Alternativ dazu kann man Blöcke auch direkt in die Template Dateien ( .phtml ) einbinden:

echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_id')->toHTML();

Die letzte Möglichkeit ist die Integration direkt in eine CMS-Seite:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.