How to pass data in the extension from one method to another method?
Posted: 17 August 2009 02:40 PM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1135
Joined  02-02-2007

Hi,

I’m writing an extension which uses two hooks and I need to pass some data from a function attached to one hook to the function attached to another hook.

I thought that this could be done passing some variable to $SESS->cache in one function as here

$SESS->cache['my_class_name']['_my_variable_name'$my_variable

and later taking its value in another function as here

$my_variable $SESS->cache['my_class_name']['_my_variable_name']

but found that this does not work.

Does $SESS->cache cannot be used for passing data from one method to another in extension? Or I try to use it incorrectly?

Or to pass data from one method to another one necessarily should use a database table?

Thanks in advance.

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile
 
 
Posted: 17 August 2009 03:26 PM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1872
Joined  10-22-2006

Do both hooks get called during the same page-load?

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 18 August 2009 12:00 AM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1135
Joined  02-02-2007

The name of the hooks are ‘comment_entries_tagdata’ and ‘insert_comment_end’.

It seems that they are called during the same page-load, isn’t it?

 Signature 

Full list of add-ons here

Child Categories
Browser Sniff
Category Id
Entries Number

Profile