Reputation: 792
In my config.xml I have:
<config>
<modules>
<Test_Quickorder>
<version>0.1.0</version>
</Test_Quickorder>
</modules>
<global>
<blocks>
<quickorder>
<rewrite>
<quickorder>Test_Quickorder_Block_Quickorder</quickorder>
</rewrite>
</quickorder>
</blocks>
</global>
<frontend>
<routers>
<quickorder>
<use>standard</use>
<args>
<module>Test_Quickorder</module>
<frontName>quickorder</frontName>
</args>
</quickorder>
</routers>
<layout>
<updates>
<quickorder>
<file>quickorder.xml</file>
</quickorder>
</updates>
</layout>
</frontend>
</config>
In app/code/community/Test/Quickorder/controllers/IndexController.php I have:
<?php
class Test_Quickorder_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout(array('default');
$this->renderLayout();
}
}
In app/design/frontend/base/default/layout/quickorder.xml I have:
<layout version="0.1.0">
<default>
<reference name="top.links">
<action method="addLink" translate="label title">
<label>Quick Order</label>
<url>quickorder</url>
<title>Quick Order</title>
<prepare/>
<urlParams/>
<position>1</position>
</action>
</reference>
</default>
<quickorder_index_index>
<reference name="root">
<action method="setTemplate">
<template>page/1column.phtml</template>
</action>
</reference>
<reference name="content">
<block type="quickorder/quickorder" name="quick" template="quickorder/quickorder.phtml"/>
</reference>
</quickorder_index_index>
</layout>
In app/design/frontend/base/default/template/quickorder/quickorder.phtml I have:
<div class="content">
<p>Hello</p>
</div>
And in app/code/community/Test/Quickorder/Block/Quickorder I have:
<?php
class Test_Quickorder_Block_Quickorder extends Mage_Core_Block_Abstract
{
}
I was expecting "Hello" to show up right in the middle of the page. Instead I get nothing. I know some part of the layout is working because when I navigate to quickorder I get
<body class="quickorder-index-index">
Can anybody point me in the right direction as to where I've gone wrong here?
Thanks in advance for any help/tips/pointers :-)
Upvotes: 0
Views: 412
Reputation: 166046
I haven't examined all your code, but this
class Test_Quickorder_Block_Quickorder extends Mage_Core_Block_Abstract
{
}
should be this
class Test_Quickorder_Block_Quickorder extends Mage_Core_Block_Template
{
}
If you want a block to render a template, it needs to be, or inherit from, Mage_Core_Block_Template
.
Upvotes: 3