vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to I create a custom global variable in vb4? (https://vborg.vbsupport.ru/showthread.php?t=269098)

N8 08-25-2011 01:20 AM

How to I create a custom global variable in vb4?
 
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:

PHP Code:

global $myglobal


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


All times are GMT. The time now is 03:06 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04406 seconds
  • Memory Usage 1,711KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete