View Full Version : Variable set in GLOBAL_COMPLETE plugin is empty in POSTBIT_LEGACY template
voteforbird
11-08-2006, 04:54 PM
When I set a variable with a plugin in global_complete, for instance like this:$variable=1;when I try to use it in the postbit_legacy template in a conditional, it has no value. Why is this happening?
Adrian Schneider
11-08-2006, 06:34 PM
The postbit is evaluated inside a function, so the variable won't have scope there.
You could always give it global scope inside one postbit hooks (postbit_dipslay_start) or use $GLOBALS[variable] instead of $variable in your template. Here is the PHP version global $variable;
voteforbird
11-08-2006, 10:30 PM
I'm a little confused about your instructions. I tried *only* using $GLOBALS[variable] in the postbit, and that didn't work. You're saying the other option is to *only* add a new plugin at postbit_display_start with contents "global $variable;"? Or am I mistaken?
Thanks.
Adrian Schneider
11-08-2006, 10:59 PM
Correct. Both should work though.
voteforbird
11-08-2006, 11:32 PM
I tried them and neither worked. If you could possibly help test, I am using this product: https://vborg.vbsupport.ru/showthread.php?t=129418 and using the variable $banner_no in the postbit.
Nevermind… got it to work Thanks!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.