Create helper for front-end module in magento1

Note:- you can download code from this rar_image
Note:-1) Firstly Disable the all cache from Cache Management tab in System tab.
2) select the default theme of the magento from the System->Design.

Step1:- Create Mywork_Usehelper.xml file in app/etc/modules/.
where Mywork is Namespace and Usehelper is Modulename.
[php]
<?xml version="1.0"?>
<config>
<modules>
<Mywork_Usehelper>
<active>true</active>
<codePool>local</codePool>
</Mywork_Usehelper>
</modules>
</config>
[/php]
Note:- 1) If you want to active the extensions then use true otherwise false.
2) there are three code pool (a) local (b) core (c) community
when we create the own extension then we use local code pool.

Step2:- Now create the config.xml file in app/code/local/Mywork/Usehelper/etc/config.xml
[php]
<?xml version="1.0"?>
<config>
<modules>
<Mywork_Usehelper>
<version>1.0.0</version>
</Mywork_Usehelper>
</modules>

<frontend>
<routers>
<usehelper>
<use>standard</use>
<args>
<module>Mywork_Usehelper</module>
<frontName>usehelper</frontName>
</args>
</usehelper>
</routers>
<layout>
<updates>
<usehelper>
<file>usehelper.xml</file>
</usehelper>
</updates>
</layout>
</frontend>

<global>

<blocks>
<usehelper>
<class>Mywork_Usehelper_Block</class>
</usehelper>
</blocks>

<helpers>
<usehelper>
<class>Mywork_Usehelper_Helper</class>
</usehelper>
</helpers>

</global>
</config>
[/php]
Note:- 1) In this file we created version of this module is 1.0.0
2) In the frontend tag we created routers tag. In routers tag we define the frontend name is usehelper,
and we access the extension value from siteurl/usehelper.

Step3:- Now we create the IndexController.php in app/code/local/Mywork/Usehelper/controllers/IndexController.php
[php]
<?php
class Mywork_Usehelper_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout();
$this->renderLayout();
}
}
[/php]

Step4:- Now create the Useblock.php in app/code/local/Mywork/Usehelper/Block/Usehelper.php
[php]
<?php
class Mywork_Usehelper_Block_Usehelper extends Mage_Core_Block_Template
{
public function _prepareLayout()
{

return parent::_prepareLayout();
}

public function Addition()
{
$helper=Mage::helper("usehelper/data");
$total=$helper->getAddition(100,200);
return $total;
}
}
[/php]

Step5:- Now create the Data.php in app/code/local/Mywork/Usehelper/Helper/Data.php
[php]
<?php
class Mywork_Usehelper_Helper_Data extends Mage_Core_Helper_Abstract
{
public function getMsg() {
return ‘Hello friends?’;
}

public function getAddition($par1,$par2) {
return $par1+$par2;
}

}
[/php]

Step6:- Now create the usehelper.xml in app/design/frontend/default/default/layout/usehelper.xml
[php]
<?xml version="1.0"?>
<layout version="0.1.0">
<usehelper_index_index>
<reference name="content">
<block type="usehelper/usehelper" name="usehelper" template="usehelper/usehelper.phtml" />
</reference>
</usehelper_index_index>
</layout>
[/php]

Step7:- Now create the usehelper.phtml in app/design/frontend/default/default/template/usehelper/usehelper.phtml
[php]
<?php
/********************Addition Two numbers********************/
echo ‘Total number is ‘.$this->Addition();
echo ‘<br/>’;
$my_helper=Mage::helper("usehelper/data");
echo ‘Message is ‘.$my_helper->getMsg();
?>
[/php]

Note:- call the url
siteurl/usehelper Output:-
Total number is 300
Message is Hello friends?