vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   What Are the Global Variable Scope Exceptions (https://vborg.vbsupport.ru/showthread.php?t=223175)

binaryg 09-14-2009 03:11 PM

What Are the Global Variable Scope Exceptions
 
I've been trying to get this code to work for quite a while and it's just not working. I've got a global variable defined that works in headerinclude and navbar but when I try to use it in SHOWTHREAD_SHOWPOST it's empty.

When a thread is loaded, this variable would essentially be used 3 different times throughout the page but it doesn't work when it's called from showthread_showpost.

I've been searching for hours and haven't come up with anything. Is SHOWTHREAD_SHOWPOST one of those templates that isn't in the global scope? If so, how I can I bring it into scope?

Lynne 09-14-2009 04:30 PM

How are you calling it? $GLOBALS[yourvariable]?

binaryg 09-14-2009 05:18 PM

In the PHP code ive used global $variable as well as $variable and in the template, when I use $globals[variable] it doesn't work...

At the moment I'm using $variable in 2 locations and it's working fine, in showthread_showpost I'm calling that variable in 3 different locations using both $globals[variable] and $variable but I'm not seeing it show up anywhere... To make sure there wasn't any other program modifying the display of that section I added it right below the body tag and right above the end body tag.

Quote:

Originally Posted by SirAdrian (Post 1884735)
Quick FYI:

$GLOBALS is case sensitive; it must be capitalized.

yeah, I had thought of that and used both :-)

Adrian Schneider 09-14-2009 05:19 PM

Quick FYI:

$GLOBALS is case sensitive; it must be capitalized.

binaryg 09-14-2009 05:34 PM

Ughh... All 15 of the references are showing up... but my understanding of the templating system is wrong... showthread_showpost only works for showpost.php... I suppose I just need to find the correct location in another template

Lynne 09-14-2009 06:01 PM

To find the template you want to modify, do this - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. Sometimes the template is the one mentioned at the very top of the page source.

binaryg 09-14-2009 06:08 PM

Wow, that's extremely helpful. I had no idea that was there

Thank you

I found where I needed to edit and all is well.


All times are GMT. The time now is 05:22 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.02578 seconds
  • Memory Usage 1,718KB
  • 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_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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