Create Global Function In Magento

Global function stands for “A function which is accessible every where in application“. When we will developing an application normally at structure time we will see some functions are common to some modules, Magneto provide helper class to create common function and access with help of helper class instance.

We will define a function in module helper file and use it everywhere in application.

You can also check other tutorial of magento,

Step 1: Register Module under app/etc/modules/phpflow.xml.
[code type=xml]





true
local


Step 2: Register helper class under app/code/local/namespace/Phpflow/etc.
[code type=xml]

Namespace_Phpflow_Helper

Step 3: create function definition under your module app/code/local/namespace/phpflow/Helper/data.php.

Step 3: Call function in application.

echo Mage::helper('phpflow')->test();

Other Way:

echo Mage::helper('phpflow/data')->test();