New to Magento. Trying to write a custom block and just make it show up at the most basic level. Been going crazy for two days, comparing my work to those of the other modules we are using plus research.
I think the issue lies somewhere with Magento not recognizing the block as being part of the global config. I need the block just to appear when I place it in local.xml
!
At app\code\local\Csos\Spuritem\etc\config.xml
:
<?xml version="1.0"?>
<config>
<modules>
<Csos_Spuritem>
<version>0.1.0</version>
</Csos_Spuritem>
</modules>
<global>
<blocks>
<spuritem>
<class>Csos_Spuritem_Block</class>
</spuritem>
</blocks>
</global>
</config>
The block definition app\code\local\Csos\Spuritem\Block\Item.php
:
<?php
class Csos_Spuritem_Block_Item extends Mage_Core_Block_Abstract {
}
When I use print_r(Mage::getConfig()->getNode()->xpath('//global//blocks'));
shows that my module is active:
[spuritem] => Mage_Core_Model_Config_Element Object
(
[class] => Csos_Spuritem_Block
)
In frontend\base\default\layout\local.xml
,
<layout version="1.0">
<default>
<reference name="content">
<block type="spuritem/item" name="spuritem.forever" template="csos/spuritem/spuritem.phtml"/>
<block type="core/template" name="showit" template="csos/showme.phtml" />
</reference>
</default>
</layout>
and finally, app\design\frontend\base\default\template\csos\spuritem\spuritem.phtml
<h1 id="spuritem">This is where my stuff will go.</h1>
In the current state, this produces nothing on the homepage. However, if in the local.xml
I change
I have allowed block permissions in the back end for "spuritem/item".
<block type="spuritem/item" name="spuritem.forever" template="csos/spuritem"/>
to
<block type="core/templatem" name="spuritem.forever" template="csos/spuritem"/>
The homepage will produce the text as expected.
What am I doing wrong?