![]() |
How to use variables created inside a hook
I have created a hook, attached at location showthread_postbit_create, in showthread.php. The code in the hook does some calculations and returns some values to some variables, let's call them $show1, $show2 etc.
At the end of the hook, I check the variables, by echoing them, and they are correct. However, when I try to use them inside postbit template, they are empty. Is there a specific way to call these variables? I even tried making them global, still no luck. Rgds and tnx |
I'd like to know that too.
|
Did you use a global before assigning the vaules?
|
Quote:
|
Unfortunatelly yes, you have to declare them as global, as I find out.
|
Really? Crap. Well then, it would be IMHO the best to use those variables as $GLOBALS['var']
its less clutter than global $var; $var = |
Another possibility:
In the Hook: $vbulletin->foo = 'bar'; In the Postbit {$this->registry->foo} |
All times are GMT. The time now is 08:52 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|