Michael
Michael

Reputation: 4876

Magento XML Layout for local module not working

I try to specify a custom layout for my module like this:

<frontend>
...
      <layout>
            <updates>
                <learn>
                    <file>learnx.xml</file>
                <learn>
            </updates>
        </layout>
...
    </frontend>

but I get a 401 (page not found) error. I try to avoid using local.xml layout for all my local modules.

I mentiont that if i delete the above layot-update and put the same content as learnx.xml in local.xml it works.

What am I doing wrong?

Thank you!

Upvotes: 0

Views: 386

Answers (2)

jacek_podwysocki
jacek_podwysocki

Reputation: 807

It looks like you have an error in your config.xml file. You have not closed the <learn> tag for instance. Also make sure that you have the correct router information for this module which is placed before stating which layout to use. The following example should give you a clue:

<frontend>
         <routers>
            <learnx>
                  <use>standard</use>
                  <args>
                     <module>Yourpackage_Learnx</module>
                     <frontName>yourfrontname</frontName>
                  </args>
            </learnx>
         </routers>
         <layout>
            <updates>
                <learnx>
                    <file>learnx.xml</file>
                </learnx>
            </updates>
        </layout>
</frontend>

Upvotes: 1

jacek_podwysocki
jacek_podwysocki

Reputation: 807

More info is needed, which file returns 401? Is it the helper that cannot be found or xml file itself?

Replacing the following tag

<learn>

with

<learnx>

may fix the error.

Magento looks up the xml file in the following order:

app/design/frontend/[interface_name]/[theme_name]/layout/learnx.xml app/design/frontend/[interface_name]/default/layout/learnx.xml app/design/frontend/base/default/layout/learnx.xml

Did you make sure you have your file on one of these locations

Upvotes: 0

Related Questions