0

I am creating a simple custom module for my magento store, just a simple html/js form to select products and list them. But I can't get the view working.

confix.xml

 <?xml version="1.0"?>
    <config>
        <modules>
            <mymodule>
                <version>1.0.0</version>    <!-- Version number of your module -->
            </mymodule>
        </modules>
        <frontend>
            <routers>
                <justlamps>
                    <use>standard</use>
                    <args>
                        <module>mymodule</module>
                        <frontName>formtest</frontName>
                    </args>
                </justlamps>
            </routers>
            <layout>
                <updates>
                    <mymodule>
                        <file>mymodule.xml</file>
                    </mymodule>
                </updates>
            </layout>
        </frontend>
    </config>

app/design/frontend/default/layout/mymodule.xml

<?xml version="1.0" ?>
    <layout version="0.1.0">
    <mymodule_index>
    <reference name="content">
        <block type="core/template" name="mymodule" template="mymodule/view.phtml"></block>
    </reference>
    </mymodule_index>
</layout>

app/design/frontend/default/template/mymodule/view.phtml

<p>test</p>
2
2

Change below code

<?xml version="1.0" ?>
    <layout version="0.1.0">
    <mymodule_index>
    <reference name="content">
        <block type="core/template" name="mymodule" template="mymodule/view.phtml"></block>
    </reference>
    </mymodule_index>
</layout>

to:

<?xml version="1.0" ?>
    <layout version="0.1.0">
    <formtest_index_index>
    <reference name="content">
        <block type="core/template" name="mymodule" template="mymodule/view.phtml"></block>
    </reference>
    </formtest_index_index>
</layout>

Make sure your layout file path should be:

app/design/frontend/Your-Theme/Your-Package/layout/mymodule.xml

0

try to putting mymodule.xml and template/mymodule/view.phtml under app/design/frontend/base/default/

so final path should be app/design/frontend/base/default/layout/mymodule.xml and app/design/frontend/base/default/template/mymodule/view.phtml

0
  • First, file name should not be confix.xml, it should be config.xml
  • In mymodule.xml, <mymodule_index> should be <justlamps_index_index>.

Please let me know if still you finds any problem.

2
  • It's not a justlamps_index_index should be formtest_index_index Frontname/controllername/actionname – Prashant Valanda Jul 28 '16 at 9:09
  • frontname is displayed in browser address bar and the tag which is defined just within <routers> tag, is used to define layout handles. – Mohit Kumar Arora Jul 28 '16 at 9:12

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.