6

I am making a custom home page for my magento website in a phtml file named home_banner.phtml, which in turn i have referenced in the CMS->Pages->Home Page content by the following code

{{block type="core/template" template="theme/home_banner.phtml"}}

In my home_banner.phtml I have called tags/popular.phtml to display the popular tags.

<div class="last-posts-grid clearfix">

     <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('tag/popular.phtml')->toHtml(); ?>

</div>

However the tags are not being displayed even though the anchor tag which says "view all tags" id getting called correctly. The ul class="tags-list" is also visible in the page source but the tags themselves are not visible. Any suggestions?

1 Answer 1

6

you need change block type core/template to tag/popular

<?php echo $this->getLayout()->createBlock('tag/popular')->setTemplate('tag/popular.phtml')->toHtml(); ?>

OR

give a name of block

{{block type="core/template" template="theme/home_banner.phtml"  name="myname"}}

then

by using xml reference include tags/popular.phtml

create local.xml at app/design/frontend/youupackage/yourtemplate/layout

put this code

<?xml version="1.0"?>
<layout version="0.1.0">
    <cms_index_index translate="label">
      <reference name="myname">
            <block type="tag/popular" name="home_tags_popular" template="tag/popular.phtml"/>
        </reference>
    </cms_index_index>
</layout>

and put below code at home_banner.phtml

echo $this->getChildHtml('home_tags_popular');
1
  • thanx amit....your 1st suggestion worked. Any idea where I can get the respective reference names of different magento elements. Like tags/popular is for displaying popular tags. What if I wanna include newsletter subscription forms, newest products, etc. What will I have to write instead of tag/popular then??? core/template does not work Commented Oct 5, 2014 at 13:11

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.