2

I'm brand new to Magento and am having trouble getting my config.xml file to load my layout file for the url: "localhost/index.php/moduleone/index/index". Can somebody help me figure out what I'm missing?

magento/app/code/local/Test/ModuleOne/etc/config.xml:

<config>
    <modules>
        <Test_ModuleOne>
            <version>0.1.0</version>
        </Test_ModuleOne>
    </modules>
    <frontend>
        <routers>
            ...
        </routers>
        <layout>
            <updates>
                <moduleone>
                    <file>moduleone.xml</file> <!-- Our layout file name-->
                </moduleone>
            </updates>
        </layout>
    </frontend>
    <global>
        ...
    </global>
</config>

magento/app/design/frontend/default/layout/moduleone.xml:

<?xml version="1.0"?>
    <layout version="0.1.0">
    <moduleone_index_index>
        <reference name="content">
            <block type="moduleone/moduleone" name="moduleone" template="moduleone/moduleone.phtml" />
        </reference>
    </moduleone_index_index>
</layout>
  • Are you sure this is correct? /app/design/frontend/default/layout/moduleone.xml:, is it missing a base folder? or am I mistaken? – Tim Hallman May 20 '15 at 4:41
  • Sorry Tim, the base folder is actually named "magento"... I'll edit the question to clarity. – Vee May 20 '15 at 4:46
  • There is still the package missing, i.e. /magento/app/design/frontend/base/default/layout/moduleone.xml – zigojacko May 20 '15 at 7:45
1

First of all,your template file location is working.

It should be

app\design\frontend\YOURPackage\YOURTemplate\layout

or app\design\frontend\base\default\layout

As per magento Design fallback logic

| improve this answer | |
  • Thanks, Amit. Looks like the tutorial I was following was using version of Magento that used the path app/design/frontend/default/default for templates and layouts. Towards the end, the author mentions to use the path you mentioned in your answer. I wish he had made that point more obvious! – Vee May 20 '15 at 20:39
  • In case it'll help anybody else, I posted a full example of a solution that renders a template and block: stackoverflow.com/questions/30340402/… – Vee May 28 '15 at 3:09
4

I always avoid Camel casing in Package and Module Name.

    <frontend>
      ----
        <layout>
          <updates>
            <moduleone module="Test_ModuleOne">
                <file>moduleone.xml</file>
            </moduleone>
          </updates>
         </layout>
    </frontend>

And Place you moduleone.xml at app\design\frontend\base\default\layout\moduleone.xml

I hope this will help you out. Good Luck :)

| improve this answer | |
  • Thanks, Robin. I'll have to try your solution sometime. I went with Amit's solution below because that seemed to be along the lines of this tutorial that I've been following. – Vee May 20 '15 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.