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

creating a new structural block in local.xml
 
Wilbo
Member
 
Total Posts:  47
Joined:  2010-11-23
 

Hi,

I’m trying to create a new structural block without modifying page.xml, just local.xml.  But I can’t get it to work.
I’ve added this in the default section of local.xml:

<!--set up a new structal blok to hold my new content-->
<
block type="core/text_list" name="my_new_block" as="my_new_block"/>
<!--
add our custom made template file-->
<
reference name="my_new_block">
    <
block type="catalog/navigation" name="myNewTemplate" template="catalog/navigation/myNewTemplate.phtml"/>
</
reference>

Then I’ve added this in the 2columns left template file:

<?php echo $this->getChildHtml('my_new_block'?>

But nothing, any ideas what I’m doing wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
alook
Jr. Member
 
Total Posts:  1
Joined:  2010-09-27
 

Hi!
I\’m trying to do exactly the same thing. did you have any success?

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagePsycho
Mentor
 
Avatar
Total Posts:  1702
Joined:  2009-06-23
 

Try this article:
http://inchoo.net/ecommerce/magento/custom-reference-structural-block/

 
Magento Community Magento Community
Magento Community
Magento Community
 
michalskr
Jr. Member
 
Total Posts:  2
Joined:  2013-06-24
 

That doesn’t really answer it since he requested it trough local.xml… I am interested in the same solution.

Edit: just found it: http://www.writeyourcode.com/add-custom-structural-block-magento/

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagikSwapna
Sr. Member
 
Total Posts:  97
Joined:  2010-12-14
 

Hello,

To create a new structural block follow the following basic steps.
1. You have to create your block html page in template “app/design/frontend/[package]/[default]/template/”
2. Named the reference block in local.xml

<reference name =”root”>  
     <
block type="core/text_list" name="homeleft" as="homeleft" translate="label">
        <
label>Left Column</label>
</
block>
</
reference>
3. Call phtml file in local.xml
<reference name="homeleft">
             <
block type="newsletter/subscribe" name="homeleft.newsletter" as="homeleftNewsletter" template="newsletter/subscribe-homeleft.phtml"/> 
     </
reference>
4. Call your new reference under phtml file
<?php echo $this->getChildHtml('homeleft'?>

Hope this will help you.

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