The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Custom Global Variables - Please Help
Hi Iam having a problem that when i include stuff in my phpinclude template the variable is not availabe to any templates. Here is an example:
Here is my phpinclude file : // This code is PHP4 only: // ob_start(); // require("yourheader.html"); // $header = ob_get_contents(); // ob_end_clean(); $authed_user = $_SERVER['PHP_AUTH_USER']; mysql_connect("localhost", "####", "#######"); mysql_select_db("######"); if (!$authed_user) { exit; } $query = "SELECT board_username,board_password from subs where u_name = '$authed_user'"; $result = mysql_query($query); $make = mysql_fetch_row($result); $b_username = $make[0]; $b_password = $make[1]; if (!$b_password || !$b_username) { $b_username = "NoUser"; $b_password = "password"; } #echo "u:$b_username p:$b_password"; #exit; When I uncomment the last 2 lines it echos the correct username and password and exits. When I comment the ehco comman and exit out (so it runs through the entire page), the variables arent being replaced on my template. Here is a copy of my username_loggedout template : <tr valign="top"> <td><input type="hidden" name="username" value="$b_username" size="25"> <input type="hidden" name="password" value="$b_password" size="25"></td> </tr> When I view the source of the page the values are showing as "". It seems like it would work but iam obviously doing something wrong. Thansk for the help. Rory |
#2
|
|||
|
|||
Forgot......
I have register globals off, and i have tested with static variables and those arent passed either. Such as : $beer = "Hot Sauce"; in the phpinclude template returns NULL when the page is generated. |
#4
|
|||
|
|||
Quote:
Rory |
#5
|
||||
|
||||
Thanks!
|
#6
|
||||
|
||||
you can't use the vars in every template, because some templates are called within a function and you have to globalize this vars in the function before, ... you have to edit functions.php
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|