Magento Forum

Layout/Block help. 
 
mark_sims
Jr. Member
 
Total Posts:  13
Joined:  2007-12-10
 

First off, I think Magento is a great package and I’m really impressed by it so far. I’ve been able to set up my store, tweak the css, and even change up the header and footer phtml file so it matched the web site it will accompany.

My question is in regards to moving the “top links” down into the middle section of the the page. I’m using the 1column.phtml template on all of my pages. Here’s what I’ve done so far. In the main.xml file I changed:

<block type="core/text_list" name="content" as="content" />
to
<block type="core/text_list" name="content" as="content">
    <
block type="page/html_toplinks" name="top.left.links" as="topLeftLinks"/>
    <
block type="page/html_toplinks" name="top.right.links" as="topRightLinks"/>
    <
block type="core/text_list" name="top.menu" as="topMenu"/>
<
block>
From what I understand, this will allow me to use the topLeftLinks, topRightLinks, and topMenu in the content part of the page. Is that correct? I tried adding
<div class="quick-access">
            <
div class="account-access">
               <
strong><?=$this->getWelcome()?></strong><?=$this->getChildHtml('topLeftLinks')?>
            
</div>
            <
div class="shop-access">
                
<?=$this->getChildHtml('topRightLinks')?>
            
</div>
        </
div>
into the 1column.phtml file, but got no results. I must be missing something here. I tried to find the design documentation, but I guess it’s not quite available yet. I am novice to Magento, so any help is greatly appreciated.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michae1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

Hi Mark,

You can have a look into Designer’s Guide to Magento

 
Magento Community Magento Community
Magento Community
Magento Community
 
Michae1
Enthusiast
 
Total Posts:  826
Joined:  2007-08-31
 

There are a few reasons your code doesn’t work:
<block type="core/text_list” sticks together the output of its children
• <?=$this->getChildHtml('topRightLinks')?> in your case makes sense only within the ‘content’ block, not it the page (you see - page has a child block named ‘content’, and block ‘content’ has a child named ‘topRightLinks’, so ‘topRightLinks’ is a grandchild of page and cannot be accessed via getChildHtml())

So, you can do the following:
• change your main.xml back
• use getBlockHtml() to access the blocks by their global names (name="”) in 1column.phtml like

<?=$this->getBlockHtml('top.right.links')?>

Please let me know if it helps.

Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top