How to access a function in block class from phtml?
I am not sure whether the class you mentioned above is a Block
or Helper
.
If it is Block, you can do:
Mage::getBlockSingleton('class_name/remaining_class_name')->getCheckboxRules();
and if it is Helper
:
Mage::Helper('class_name/remaining_class_name')->getCheckboxRules();
Where
class_name
is name of registered class name inBlock
/Model
/Helper
in your module. Checkconfig.xml
file of the module.
For Example:
If you want to use Mage_Core_Block_Template_Facade
Block from core/Mage
files. You can use:
Mage::getBlockSingleton('core/template_facade');
Where
core
text in the above code can be found fromcore/Mage/Core/etc/config.xml
<blocks> <!-- line#91 in Magento 1.8.0 --> <core> <class>Mage_Core_Block</class> </core> </blocks>
From above,
Mage_Core_Block
can be converted tocore
if you want get of function of helper class then we below
For,helper:
Mage::helper('modulename/rest_ofclass')->yourFunction();
That means
For You case:
Mage::helper('modulename/rest_ofclass')->yourFunction()
;
modulename/rest_ofclass
1) modulename
depends on helper class deceleration on your config.xml.)
<helpers>
<modulename>
<class>Magestore_RewardPoints_Helper</class>
</modulename>
</helper>
2) rest_ofclass
(Magestore_RewardPoints_Helper)rest of class from Block_Spend