0

I have local.xml like this,

<?xml version="1.0"?>
    <layout>
        <default> 
            <reference name="footer">
                <block type="core/template" name="footerblock" template="footerblock.phtml" >
                <block type="core/template" name="copyright" template="copyright.phtml" />
            </reference>

        </default>
    </layout>

So in the footer, I can access child templates footer.phtml,

<?php echo $this->getChildHtml('footerblock'); ?> 
<?php echo $this->getChildHtml('copyright'); ?> 

And I can access footer links in footer.phtml file, but how can I access it in footerblock.phtml file like this?

<?php echo $this->getChildHtml('footer_links'); ?> 
1
  • you need to make footer_links a child of footerblock, and not of footer
    – Alex Dinca
    Commented Sep 20, 2014 at 12:03

3 Answers 3

1

Add path file page/template

<block type="core/template" name="footerblock" template="page/template/footerblock.phtml" >
<block type="core/template" name="copyright" template="page/template/copyright.phtml" />

or

U can direct access this code on footer file:

getLayout()->createBlock('core/template')->setTemplate('page/html/footerblock.phtml')->toHtml();

0

Use this in footerblock.phtml

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links')->toHtml() ?>
1
  • this code call for cmsblock not page core template file. Commented Sep 20, 2014 at 12:20
0

As you want to add this at footer then footer_links should called as file

   <?xml version="1.0"?>
        <layout>
            <default> 
                <reference name="footer">
                    <block type="core/template" name="footerblock" template="footerblock.phtml" >

                    <block type="core/template" name="copyright" template="copyright.phtml" />
 <!-- add this -->
    <block type="cms/block" name="footer_links" />
                </reference>

            </default>
    </layout>

As cms/block block is not need to define it template file so i am not added template now you need to juct call at footer.phtml

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

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.