I'm trying to have just a little "hello world" like module to learn how to make modules. I've got a fairly fresh install of Magento 1.7 on a Mac OSX 10.6 local server. I'm following Pierrefay's Turtorial and I cant get the block to display. I've been all over the web, but nothing has worked. The module's page just shows the default look with the 'dog' and the 'Back to School' ad. I've got Alan's Layoutviewer module. I'm currently in debug mode and emptying the cache like mad. I have already told Mag. not to cache anything,anyway. I've managed to reach the point where I'm not generating error messages (I'm also in debug mode and have execption.log and system.log pulled up).
My Controller:
<?php
class Nationwide_Cartonplugin_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction ()
{
$this->loadLayout();
$this->renderLayout();
//var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());
//exit("bailing early at ".__LINE__." in ".__FILE__);
//echo "Carton Exists";
//Mage::log(
// $this->getLayout()->getUpdate()->getHandles(),
// null, ‘layout.log’ );
//Mage::log(
// $this->getLayout()->getUpdate()->asString(),
// null, ‘layout.log’ );
}
public function mamethodeAction ()
{
echo 'test mymethod';
}
}
My Config:
<?xml version="1.0"?>
<config>
<modules>
<Nationwide_Cartonplugin>
<version>1.1.0</version>
</Nationwide_Cartonplugin>
</modules>
<global>
<blocks>
<cartonplugin>
<class>Nationwide_Cartonplugin_Block</class>
</cartonplugin>
</blocks>
</global>
<frontend>
<routers>
<cartonplugin>
<use>standard</use>
<args>
<module>Nationwide_Cartonplugin</module>
<frontName>carton</frontName>
</args>
</cartonplugin>
</routers>
<layout>
<updates>
<cartonplugin>
<file>carton.xml</file>
</cartonplugin>
</updates>
</layout>
</frontend>
</config>
My Layout: (frontend/default/nationwide/layout/carton.xml)(I'm using default & nationwide in the admin setup)
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="content">
</reference>
</default>
<cartonplugin_index_index>
<reference name="content">
<block output="toHtml" type="cartonplugin/myblock" name="myblock"
template="cartonplugin/cartondisplay.phtml"/>
</reference>
</cartonplugin_index_index>
</layout>
Uncomenting the references generate a "not valid template" error.
My Template: (frontend/default/nationwide/template/cartonplugin/cartondisplay.phtml)
<?php
//echo $this->methodcarblock();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello World</title>
<style type="text/css">
body {
background-color:#f00;
}
</style>
</head>
<body>
<div class="test1">
<?php echo $this->methodcarblock(); ?>
</div>
</body>
</html>
My block:
<?php
class Nationwide_Cartonplugin_Block_Myblock extends Mage_Core_Block_Template
{
public function methodcarblock()
{
return 'informations about my block !!';
}
}
It seems I follow everying on the web and nothing still works, other than echoing from the index action. I would greatly appreciate any help.
