vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Setting PHP Variables (https://vborg.vbsupport.ru/showthread.php?t=39599)

JAC 06-08-2002 04:36 AM

Setting PHP Variables
 
If I set a variable in "forumdisplay.php" should I be able to access it in any of the templates called by "forumdisplay.php"? Because I have tried and not been able to.

Admin 06-08-2002 05:39 AM

You should be able to.

Where did you set the variable and where are you using it?

JAC 06-08-2002 01:44 PM

I set it right after the moderator section in "forum_display.php" around line 119, and I'm trying to use it in "forumdisplay_forumbit_level1_post" .

Also where is the "$forum[moderators]" variable set at in the code, I've searched everywhere and can't find it.

Admin 06-08-2002 02:45 PM

(1) Globalize the variable name in the makeforumbit() function, in that same file.

(2) Here:
PHP Code:

        unset($forum['moderators']);
        
$listexploded=explode(","$forum['parentlist']);
        while ( list(
$mkey1,$mval1)=each($listexploded) ) {
          if ( !isset(
$imodcache["$mval1"]) ) {
            continue;
          }
          
reset($imodcache["$mval1"]);
          while ( list(
$mkey2,$moderator)=each($imodcache["$mval1"]) ) {
            if ( !isset(
$forum['moderators']) ) {
              eval(
"\$forum['moderators'] = \"".gettemplate('forumhome_moderator')."\";");
            } else {
              eval(
"\$forum['moderators'] .= \", ".gettemplate('forumhome_moderator')."\";");
            }
          }
        }

        if ( !isset(
$forum['moderators']) ) {
          
$forum['moderators'] = ' ';
        } 


JAC 06-08-2002 06:07 PM

Worked Perfectly
Thanks A Bunch :)

conductorchris 06-12-2002 11:10 PM

I'm having a similar problem: I appended an image swapping script to the global.php file and the variables are not being read by the header template: <img src="<?echo $imgsrc;?>" >

What does it mean to globalize the variable name?

Thanks, Chris

Admin 06-13-2002 05:59 AM

conductorchris, please go to this page and enter your username, to show you are licensed. (you will need to use your customer number and password to access that page)
Thank you.

gmarik 06-13-2002 01:50 PM

Tell me please (gmarik@hotbox.ru) is there a site, where is explained the PHP code of vb.2.2.6. and the new things, that will be in vb.3.0.?

Admin 06-13-2002 02:08 PM

gmarik, please go to this page and enter your username, to show you are licensed. (you will need to use your customer number and password to access that page)
Thank you.


All times are GMT. The time now is 07:07 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.01762 seconds
  • Memory Usage 1,734KB
  • 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
  • (9)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