We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to pass data in the extension from one method to another method?

Development and Programming

Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

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.

       
silenz's avatar
silenz
1,651 posts
16 years ago
silenz's avatar silenz

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

       
Laisvunas's avatar
Laisvunas
879 posts
16 years ago
Laisvunas's avatar Laisvunas

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?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.