1

Developing a module and trying to get it to display what i have in my block.

I have read a lot of tutorials online but no of them helping me with this problem.

My module have loaded its own layout, but when i insert the <block type.... i get a white page on the front end.

config.xml

<?xml version="1.0"?>
<config>
  <modules>
    <Puk_EmailOrder>
      <version>0.1.0</version>
    </Puk_EmailOrder>
  </modules>
    <frontend>
        <routers>
            <routeurfrontend>
                <use>standard</use>
                <args>
                    <module>Puk_EmailOrder</module>
                    <frontName>emailorder</frontName>
                </args>
            </routeurfrontend> 
        </routers>
        <layout>
            <updates>
                <emailorder>
                    <file>emailorder.xml</file>
                </emailorder>
            </updates>
        </layout>
    </frontend>
  <global>
    <helpers>
      <emailorder>
        <class>Puk_EmailOrder_Helper</class>
      </emailorder>
    </helpers>
    <blocks>
      <emailorder>
        <class>Puk_EmailOrder_Block</class>
      </emailorder>
    </blocks>
    <models>
        <emailorder>
            <class>Puk_EmailOrder_Model</class>
            <resourceModel>emailorder_mysql4</resourceModel>
        </emailorder>
        <emailorder_mysql4>
            <class>Pfay_Test_Model_Mysql4</class>
            <entities>
                <emailorder>
                    <table>emailorders</table>
                </emailorder>
            </entities>
        </emailorder_mysql4>
      </models> 
    <resources>
      <emailorder_setup>
        <setup>
          <module>Puk_EmailOrder</module>
        </setup>
        <connection>
          <use>core_setup</use>
        </connection>
      </emailorder_setup>
      <emailorder_write>
        <connection>
          <use>core_write</use>
        </connection>
      </emailorder_write>
      <emailorder_read>
        <connection>
          <use>core_read</use>
        </connection>
      </emailorder_read>
    </resources>
  </global>
  <admin>
    <routers>
      <emailorder>
        <use>admin</use>
        <args>
          <module>Puk_EmailOrder</module>
          <frontName>admin_emailorder</frontName>
        </args>
      </emailorder>

    </routers>
  </admin>
  <adminhtml>
    <menu>
      <emailorder module="emailorder">
        <title>Email Order</title>
        <sort_order>100</sort_order>
        <children>
          <emailorderbackend module="emailorder">
            <title>Email Orders</title>
            <sort_order>0</sort_order>
            <action>admin_emailorder/adminhtml_emailorderbackend</action>
          </emailorderbackend>
        </children>
      </emailorder>
    </menu>
    <acl>
      <resources>
        <all>
          <title>Allow Everything</title>
        </all>
        <admin>
          <children>
            <emailorder translate="title" module="emailorder">
              <title>Email Order</title>
              <sort_order>1000</sort_order>
              <children>
          <emailorderbackend translate="title">
            <title>Email Orders</title>
          </emailorderbackend>
              </children>
            </emailorder>
          </children>
        </admin>
      </resources>
    </acl>
    <layout>
      <updates>
        <emailorder>
          <file>emailorder.xml</file>
        </emailorder>
      </updates>
    </layout>
  </adminhtml>
</config> 

The layout xml (app/design/frontend/ultimo/default/layout/emailorders.xml)

<layout version="0.1.0">

     <default>
          <reference name="content"></reference>
      </default>
      <routeurfrontend_index_index>
           <reference name="root">
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    </reference>
          <reference name="content">
                <block type="emailorder/monblock"  template="emailorder/afficher.phtml" />
           </reference>
      </routeurfrontend_index_index>
</layout>

my block.php (.../Puk/EmailOrder/Block/Monblock.php)

<?php
class Puk_EmailOrders_Block_Monblock extends Mage_Core_Block_Template
{
     public function methodblock()
     {
         return 'informations about my block !';
     }
}

My template (app/design/frontend/ultimo/default/template/emailorder/afficher.php)

<?php

echo $this->methodblock();
?>

What am I doing wrong?

2
  • OMG! Was that all! I been staring at it for so long! Thx! Jan 29, 2016 at 14:05
  • Glad that helped! I've added my comment as an answer, so feel free to mark it as accepted. Jan 29, 2016 at 14:23

1 Answer 1

3

You have an extra "s" in the name of your Block class:

class Puk_EmailOrders_Block_Monblock extends Mage_Core_Block_Template

Should be:

class Puk_EmailOrder_Block_Monblock extends Mage_Core_Block_Template.

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