View Full Version : Accessing variable of one plugin from another
Say I have a variable $myvar in global_bootstrap_complete.
How do I access it from postbit_display_complete?
Also, what do the "shaded" hooks mean in debug info?
Lynne
01-21-2011, 10:04 PM
Shaded means the hook is available but not being used by an active plugin on that page.
Usually the variable should be available for use. However, sometime a hook is in a function and you may have to globalize the variables in order to use it there.
Can you show me an example? I tried using global before, it didn't work.
For example,
global_bootstrap_complete
global $myvar = 5;
process_templates_complete
global $myvar;
$f = fopen('debugx.txt', 'w');
fwrite ($f, print_r($myvar, true));
fclose($f);
I tried with/without global (and a few combination of hooks) before but debugx.txt is always empty.
Lynne
01-22-2011, 12:48 AM
global_bootstrap_complete:
global $myvar;
$myvar = 5;
process_templates_complete:
global $myvar;
other code
* CvP punches himself.
result of not having proper sleep.
Thanks Lynne :D
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.