PDA

View Full Version : How to I create a custom global variable in vb4?


N8
08-25-2011, 01:20 AM
I want to create some custom variables, that I can use site-wide in any template I throw it in.

This was easy to do in VB3, creating a plugin under global_start - that kind of works in VB4 however I can't call on any of the variables in my CMS

Anyone know how this can be accomplished?

kh99
08-25-2011, 01:31 AM
You could try using global_bootstrap_init_start instead. That's inside a function so you'll need to declare your variables as global if you want to access them from elsewhere (but not if you just want to register them to use in templates).

N8
08-25-2011, 05:22 AM
How does one "declare your variables as global"

Or better, where can I learn about that function?

I can't seem to be able to find any information about that on vb.com

kh99
08-25-2011, 08:25 AM
I'm just talking about the PHP 'global' statement, like:

global $myglobal;


Just put that in your code before you use the variable;