Creating a helper is quite easy, go on your /etc module directory and edit your config.xml file
ex : app/code/local/Adin/Epub/etc/config.xml
Add a
<?xml version="1.0"?> <config> <modules> <Adin_Epub> <version>1.0.0</version> </Adin_Epub> </modules> <global> <helpers> <epub> <class>Adin_Epub_Helper</class> </epub> </helpers> </global> </config>
Then creates the Helper folder on your module directory and create a data class :
app/code/local/Adin/Epub/Helper/Data.php
<?php
class Adin_Epub_Helper_Data extends Mage_Core_Helper_Abstract
{
//fonction de test
public function getTest()
{
return "Ceci est un test de helper";
}
}
If you create a new module, don’t forget to activate it, for that, in app/etc/modules directory, create or append a xml file and add your new module, for example :
<?xml version="1.0"?>
<config>
<modules>
<Adin_Epub>
<active>true</active>
<codePool>local</codePool>
</Adin_Epub>
</modules>
</config>
Now, for using your new helper, just instanciate it and call the function :
$helper = Mage::helper('epub');
echo $helper->getTest();