Sunday, 15 April 2012

php - Call a custom module helper from template file of another module -



php - Call a custom module helper from template file of another module -

i have created new module. module connected database. want phone call helper class module template file allow "description.pthml". used next code.

$_helper = $this->helper('forumprodposts/output');

but getting error "fatal error: class 'mage_forumprodposts_helper_output' not found in /home/black/public_html/app/mage.php on line 546".

the helper class located in local/mywebsite/forumprodposts/helper/output.php having next code.

class mywebsite_forumprodposts_helper_output extends mage_core_helper_abstract { /** * constructor */ public function __construct() { mage::dispatchevent('forumprodposts_helper_output_construct', array('helper'=>$this)); } public function getforumposts(){ echo "i m here"; exit; } }

also config.xml of module

<?xml version="1.0"?> <config> <modules> <mywebsite_forumprodposts> <version>0.1.0</version> </mywebsite_forumprodposts> </modules> <frontend> <routers> <forumprodposts> <use>standard</use> <args> <module>mywebsite_forumprodposts</module> <frontname>forumprodposts</frontname> </args> </forumprodposts> </routers> <layout> <updates> <forumprodposts> <file>forumprodposts.xml</file> </forumprodposts> </updates> </layout> </frontend> <global> <helpers> <forumprodposts> <class>mywebsite_forumprodposts_helper</class> </forumprodposts> </helpers> <resources> <forumprodposts_write> <connection> <use>phpbb_database</use> </connection> </forumprodposts_write> <forumprodposts_read> <connection> <use>phpbb_database</use> </connection> </forumprodposts_read> <forumprodposts_setup> <connection> <use>core_setup</use> </connection> </forumprodposts_setup> <forumprodposts_database> <connection> <host><![cdata[localhost]]></host> <username><![cdata[user]]></username> <password><![cdata[password]]></password> <dbname><![cdata[forumdb]]></dbname> <model>mysql4</model> <type>pdo_mysql</type> <active>1</active> </connection> </forumprodposts_database> </resources> </global> </config>

seems me magento not recognizing module. help me doing wrong.

i have realized module not appearing in configuration/advanced section of admin panel. have done reindexing , clear cashe mywebsite_forumprodposts.xml in etc/modules have follwing code.

<?xml version="1.0"?> <config> <modules> <mywebsite_forumprodposts> <active>true</active> <codepool>local</codepool> </mywebsite_forumprodposts> </modules> </config>

i think naming convention must match name defined in config.xml. seek code given below

$_helper = $this->helper('forumprodposts/output'); // in little letter defined in xml file

php magento module

No comments:

Post a Comment