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

Layout Update Problem
 
zanete
Jr. Member
 
Total Posts:  3
Joined:  2008-03-03
 

hi,

i’m very new to magento but it looks great. however, i’ve spent the whole day trying to figure out how to get the backend to show a template that i want it to show.

I’ve created a new local module called ContentPage for building page structures dynamically instead of using hardcoded layouts. but i can’t get it to show the template i’ve created for it unless i go inside the

app\design\adminhtml\default\default\layout\main.xml
and physically replace the line 59
' <block type="core/text_list" name="content" as="content"/>'

with

'<block type="contentpage/main" name="content" as="content"/>'

Could someone please explain what layout update xml ( file that i’ve placed in

app\design\adminhtml\default\default\layout\contentpage.xml
) should contain so that when i’m in url /contentpage/main it is using html created by
MyNamespace_ContentPage_Block_Main
?

That would be very much appreciated!
Zanete

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mark_Kimsal
Sr. Member
 
Total Posts:  186
Joined:  2007-09-12
Michigan, USA
 

Hey good start on the module.  You’ve started out way ahead of me.

In order for your “app\design\adminhtml\default\default\layout\contentpage.xml “ to be activated, you have to turn it on in your module’s etc/config.xml.  Otherwise, Magento won’t pick up the xml file at all. (make sure to turn off caching while you’re making your new module)

<global>
   <
frontend>
      <
layout>
          <
updates>
              <
contentpage>
                  <
file>contentpage.xml</file>
              </
contentpage>
         </
updates>
      </
layout>
   </
frontend>
</global>

This will activate the parsing of your layout/contentpage.xml

The contents of your layout file should look like this:

<?xml version="1.0"?>
<layout version="0.1.0">
   <!-- 
this tag follows the URL pattern contentpage/main/ -->
    <
contentpage_main_index>
        <
reference name="root">
            <!-- 
put your block code under the "root"  and replace whatever "content" block was there -->
            <
block type="contentpage/main" name="content" as="content"/>
        </
reference>
    </
contentpage_main_index>
</
layout>

Hopefully this should work.  I haven’t tested it, but the idea is to make your block “contentpage/main” as the only block named “content” under the root.  The only problem that you might have is if other modules want to add themselves to “content”, you will need to accommodate them as a block type “core/text_list”, which is the default type of the “content” block found in page.xml.

 
Magento Community Magento Community
Magento Community
Magento Community
 
zanete
Jr. Member
 
Total Posts:  3
Joined:  2008-03-03
 

Wicked!! this seems to have done the trick. The only thing that i hadn’t done properly was the

<reference name="root">
bit. I had it as
<reference name="content">
My guess work wasn’t paying off.
Thanks so much!
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top