What i want to achieve is that I have some html code in the cms/homepage/design, which I want to insert after a certain element in the homepage. This is the xml code:

<cms_index_index translate="label">
        <reference name="content">
            <block type="sama_productblocks/list" name="sama_productblocks_newproducts" after="call_to_actions" template="sama_productblocks/list.phtml">
                <action method="setIdentifier"><id>homepage-latest</id></action>

            <block type="core/template" name="top_banners" before="-" template="homepage/topbanners.phtml">
                <block type="experius_linkmanager/link_list" name="homepage_banner">
                    <action method="setIdentifier"><key>hoesjesoutlet-homepage_banner</key></action>
                <block type="experius_linkmanager/link_list" name="homepage_small">
                    <action method="setIdentifier"><key>hoesjesoutlet-homepage_small</key></action>
            <block type="core/template" name="cta_banners" after="modelfilter_search" template="homepage/cta.phtml">
                <block type="experius_linkmanager/link_list" name="homepage_cta">
                    <action method="setIdentifier"><key>hoesjesoutlet-homepage_cta</key></action>
            <block type="core/template" name="home_text" after="modelfilter_search" template="homepage/text.phtml">
                <!-- Here should I call the html code -->

and the content of the text.phtml should be the html code from the design tab. Well I do not want to remove it from design and put it all of the html code. Is there a function or method to call the content of design from the homepage ? This is the content of the template/homepage/text.phtml

<div class="cta_row">
    <?php // echo $this->getChildHtml('homepage_text');
    // here i want to put the html code from the design tab from homepage

1 Answer 1


Put your html content inside a new phtml file. This is how you should do it.

File: app\design\frontend\{your_package}\{your_theme}\template\homepage\my_homepage.phtml

<!-- put your html code inside this file -->

ie your html codes comes inside my_homepage.phtml template. Now update the last part of your xml code like this.

<block type="core/template" name="home_text" after="modelfilter_search" template="homepage/text.phtml">
    <!-- call to your custom html code block -->
    <block type="core/template" name="my.homepage.block" as="homepage_text" template="homepage/my_homepage.phtml" />

Now make sure your text.phtml holds this call..

<?php echo $this->getChildHtml('homepage_text') ?>

Then clear all cache and load the page again. You are done.


If you want those html codes editable from admin, then as you have stated in your comment, put those html codes inside a static block with an identifier homepage_custom_code (you can use anything here) and then change your xml code like this.

Layout update approach

<block type="core/template" name="home_text" after="modelfilter_search" template="homepage/text.phtml">
    <!-- call to your custom html code block -->
    <block type="cms/block" name="my.homepage.sb" as="homepage_text">
         <action method="setBlockId">

and then call your custom block in text.phtml like the same way we did just above ^^^^.

Hard coding approach : (I hate this.)

Otherwise call your static block directly inside your text.phtml like this.

          array('block_id' => 'homepage_custom_code')

Both way works. But I recommend the first approach. For me, it looks more clear one.

  • I do not want to put the html code inside a phtml file. I want to keep it editable from admin panel. I created a static block a put all of the html code there. then I put the xml code: <block type="core/template" name="home_text" after="modelfilter_search" template="homepage/text.phtml"> </block> and after that in the text.phtml i put this html code and it works: <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); ?>. But I am not sure that this is a proper way Aug 10, 2015 at 7:38
  • yes you can use that approach definitely. see my update Aug 10, 2015 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.