vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Variable set in GLOBAL_COMPLETE plugin is empty in POSTBIT_LEGACY template (https://vborg.vbsupport.ru/showthread.php?t=131094)

voteforbird 11-08-2006 04:54 PM

Variable set in GLOBAL_COMPLETE plugin is empty in POSTBIT_LEGACY template
 
When I set a variable with a plugin in global_complete, for instance like this:
Quote:

$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
PHP Code:

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!


All times are GMT. The time now is 07:58 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.00952 seconds
  • Memory Usage 1,719KB
  • 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)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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