0

I'm trying to create a new page to my module without success. I have created a module with the contents:

app\code\local\CompanyName\Insignias\etc\config.xml

<config>
    <modules>
        <CompanyName_Insignias>
            <version>0.0.1</version>
        </CompanyName_Insignias>
    </modules>
    <frontend>
        <routers>
            <insignias>
                <use>standard</use>
                <args>
                    <module>CompanyName_Insignias</module>
                    <frontName>insignias</frontName>
                </args>
            </insignias>
        </routers>
        <layout>
            <updates>
                <insignias>
                    <file>insignias.xml</file>
                </insignias>
            </updates>
        </layout>
    </frontend>
  <...>
</config>

app\code\local\CompanyName\Insignias\controllers\IndexController.php

<?php

class CompanyName_Insignias_IndexController extends Mage_Core_Controller_Front_Action {

    public function indexAction() {
        $this->loadLayout();
        $this->renderLayout();
    }

}

and

app/design/frontend/base/default/layout/insignias.xml

<?xml version="1.0"?>
<layout>
  <insignias_index_index>
    <reference name="content">
      <block type="insignias/index" name="insignias_index" template="insignias/index.phtml" />
    </reference>
  </insignias_index_index>
</layout>

I have created the index.phtml file at app/design/frontend/base/default/template/insignias/index.phtml with a <?php echo "worked" ?> to test it, but when I try to access domain/index.php/insignias it shows me all the default magento blocks, but without my echo content, just a blank page in the content

Can someone help me?

edit:

enter image description here

6
  • Is it showing blank page or 404 not found page? can you please send screenshot?
    – Gulshan
    Commented Mar 10, 2017 at 14:58
  • just a blank page Commented Mar 10, 2017 at 14:59
  • can you send a screenshot of that page so that I can check.
    – Gulshan
    Commented Mar 10, 2017 at 16:35
  • just edited the content Commented Mar 10, 2017 at 16:38
  • please check system.log file under var/log folder. I think you will get error there. If not then enable developer mode and check log file again
    – Gulshan
    Commented Mar 10, 2017 at 16:41

1 Answer 1

1

Thats because you didn't created Block file and mentioned block name in your .xml file.

<reference name="content">
            <action method="setTemplate">
                <template>insignias/index.phtml</template>
            </action>
        </reference>

try this without block in your xml. hope this helps.

3
  • I did it here: <reference name="content"> <block type="insignias/index" name="insignias_index" template="insignias/index.phtml" /> </reference> Commented Mar 10, 2017 at 16:59
  • did you create Block file inside block folder and mentioned block inside config.xml file? Once you did this then your code should work as expected. Commented Mar 10, 2017 at 17:01
  • no problem.. Happy Coding :) Commented Mar 10, 2017 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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