I am trying to create a block containing a method callable on my template
I believe i doing something wrong with capital letters or declaration conventions in my xml files. I did not manage to declare properly my block in the layout file.
can anyone help ?
local/Maticode/WebLog/etc/config.xml :
<?xml version="1.0"?>
<config>
<modules>
<Maticode_WebLog>
<version>
0.1.0
</version>
</Maticode_WebLog>
</modules>
<frontend>
<routers>
<weblog>
<use>standard</use>
<args>
<module>Maticode_WebLog</module>
<frontName>weblog</frontName>
</args>
</weblog>
</routers>
<layout>
<updates>
<weblog>
<file>webloglayout.xml</file>
</weblog>
</updates>
</layout>
</frontend>
<global>
<blocks>
<weblog>
<class>Maticode_WebLog_Block</class>
</weblog>
</blocks>
</global>
</config>
local/Maticode/WebLog/Block/monblock.php:
<?php
class Maticode_WebLog_Block_Monblock extends Mage_Core_Block_Template
{
public function methodblock()
{
return 'informations de mon block !!';
}
}
design/frontend/base/default/layout/webloglayout.xml:
<layout version="0.1.0">
<weblog_index_index>
<reference name="root">
<!--http://localhost/magento/weblog/ outputs : 'here'-->
<!-- <block type="page/html" name="root" output="toHtml" template="weblog.phtml" />-->
<!--this does not display the template -->
<block type="weblog/monblock" name="afficher_monbloc" template="weblog.phtml" />
</reference>
</weblog_index_index>
</layout>
design/frontend/base/default/template/weblog.phtml:
<?php
echo 'here';
echo $this->methodblock();
?>