2

Currently i'm working to redesign a custom Magento template.

I'm facing the following problem.

In file called: 2columns-left.phtml i am facing code like this several times:

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

or

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

These code lines makes me think that they are calling blocks and the content in them by getting the name of .phtml file.

So i have file called slider_layred_nav.phtml and i want to call all the content in it in file 2columns-left.phtml so i tried this code:

So in file 2columns-left.phtml i put:

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

But it is just not displaying anything.

I assume that i have to do something with the layout but i have no idea what.

Can you help me our resolve this mystery ?

Thanks in advance!

3

So in file 2columns-left.phtml i put:

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

First, check your spelling ("slider_layred_nav" => "slider_layered_nav"). You will then want to specify in some layout XML file (e.g. local.xml, which you can create in your theme) the following directive:

<reference name="root">
    <block type="core/template"
           name="slider_layered_nav"
           template="path/to/template.phtml" />
</reference>

You may need to change the type based on the behaviors you need. Also, this directive needs to go inside a layout update handle. If you want this block to show up on every page, you would put it inside <default />:

<default>
    <reference name="root">
        <block type="core/template"
               name="slider_layered_nav"
               template="path/to/template.phtml" />
    </reference>
</default>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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