Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Adding your own structural block
 
TimC
Jr. Member
 
Total Posts:  15
Joined:  2007-12-06
 

I must be missing something but I just can’t seem to get custom structural blocks to work.

Here’s what I do in page.xml

<default>
        <
block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">

            <
block type="page/html_header" name="header" as="header">
                <
block type="page/html_toplinks" name="top.left.links" as="topLeftLinks"/>

                <
block type="page/html_toplinks" name="top.right.links" as="topRightLinks"/>
                <
block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
                <
block type="core/text_list" name="top.menu" as="topMenu"/>
            </
block>

            <
block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>

                                    <
block type="page_html" name="customblock" as="customblock" template="page/html/customblock.phtml"/>

            <
block type="core/text_list" name="left" as="left"/>

            <
block type="core/messages" name="global_messages" as="global_messages"/>
            <
block type="core/messages" name="messages" as="messages"/>

            <
block type="core/text_list" name="content" as="content"/>

            <
block type="core/text_list" name="right" as="right"/>

            <
block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
                <
block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
                <
block type="core/template_links" name="footer_links" as="footer_links" template="page/html/links.phtml"/>
            </
block>

            <
block type="core/text_list" name="before_body_end" as="before_body_end"/>
        </
block>

        <
block type="core/profiler" output="toHtml"/>
    </default>

And then I inserted the following in 3columns.phtml

[code<?=$this->getChildHtml('customblock')?>]

But still the block won’t show up.

 
Magento Community Magento Community
Magento Community
Magento Community
 
John
Sr. Member
 
Avatar
Total Posts:  129
Joined:  2007-12-20
Sheffield, United Kingdom
 

Just a guess but should it not be

<block type="page/page_html" ...

Also - have you referenced it in catalog.xml?

See : http://www.magentocommerce.com/design_guide/articles/intro-to-layouts

Rgds
John

 
Magento Community Magento Community
Magento Community
Magento Community
 
TimC
Jr. Member
 
Total Posts:  15
Joined:  2007-12-06
 

But say I wanted to check if someone was logged in or not and show a menu? As far as I understand it, you can’t do that with CMS blocks?

 
Magento Community Magento Community
Magento Community
Magento Community
 
roskolnikov
Member
 
Avatar
Total Posts:  31
Joined:  2008-01-02
Caribbean
 

Log in and log out? you need just to put the the following

<div class="account-access">
<?=$this->getChildHtml('topLeftLinks')?>
</div>

which is in the page/html/header.phtml

into where ever you want and then style it in boxes.css from there.

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