PDA

View Full Version : How to get PHP to work in the header in vBulletin


imported_Psybadek
01-12-2007, 09:26 AM
Im trying to use the $totalonline php variable in the header, but it wont work, here what I got.


<!-- content table -->
$spacer_open

$_phpinclude_output

<HTML>
<HEAD>
<link rel=stylesheet type="text/css" href="http://www.gamingupdate.com/forums/SC/style01.css">


<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE
var noNewLogin = "false";
var dc = document.cookie;
var sessionLogin = escape("");
var sessionLoginDT = escape("");

if (document.cookie) {
var DaysPrune = getCookie("DaysPrune");
if (DaysPrune == null) {
var DaysPrune = "45";
}
} else {
var DaysPrune = "45";
}

expireDate = new Date;
if (expireDate.getYear() < 1900) {
expireDate.setYear(expireDate.getYear() + 1900 + 1);
} else {
expireDate.setYear(expireDate.getYear()+1);
}

if (noNewLogin != "true") {

var CookieLogin = escape("2452066");
var CookieLoginDT = escape("06-05-2001 12:00 AM");

document.cookie = "lastLogin=" + CookieLogin + ";expires=" + expireDate.toGMTString() + ";";
document.cookie = "LastLoginDT=" + CookieLoginDT + ";expires=" + expireDate.toGMTString() + ";";
document.cookie = "sessionLogin=" + sessionLogin + ";";
document.cookie = "sessionLoginDT=" + sessionLoginDT + ";";
}

function getCookie(name){
var cname = name + "=";
var dc = document.cookie;
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
return unescape(dc.substring(begin, end)); }
}
return null;
}
// STOP HIDING FROM OTHER BROWSERS -->
</SCRIPT>
</head>
<BODY bgcolor="#000000" text="#ffffff" link="#ffbf00" alink="#ff7f00" vlink="#ffbf00" marginheight=0 marginwidth=0 topmargin=0 leftmargin=0 rightmargin=0>

<FONT FACE="Verdana, Arial" SIZE="2">
<table width="100%">

<tr>

<td colspan="2" width="100%" align="center"><table width="100%"><tr><td align="left" valign="bottom"><form name="login_form" action="http://vgnmailcom.mail.everyone.net/email/scripts/loginuser.pl" method="post" target="_blank"><font face="verdana, arial"><font size="1"><b>Log on to your free VGNMail.com account...? Or New users?<a href="http://www.vgnmail.com" target="_blank">sign up</b></a>!<br>Username: <input type="text" name="loginName" size="15" value="" maxlength=32>@VGNMail.com?????Password: <input type="password" name="user_pwd" size=15 maxlength=32>?<input type="submit" name="login" value="Login"></form></td><td align="right" valign="bottom"><font face="verdana, arial"><font size="1"><b>Super Cheats is part of <a href="http://www.videogamernetwork.com" target="_blank">Video Gamer Network</a></b></font></font></td></tr></table></td>

</tr>

<tr>

<td colspan="2" width="100%" bgcolor="#333333">

<table width="100%"><tr><td align="left" valign="bottom"><a href="home.htm"><img src="http://www.gamingupdate.com/forums/SC/supercheats01.gif" border="0" alt="SuperCheats.com"></a></td>

<td align="right" valign="bottom">

<a href="http://www.ugo.com"><img src="http://www.gamingupdate.com/forums/SC/ugologo01.gif" alt="Part of the UGO Alliance" border="0"></a>

</td></tr></table>

</td>

</tr>

<tr>

<td colspan="2" bgcolor="#666666">

<table width="100%"><tr><td align="left" valign="bottom"><font face="verdana, arial"><font size="1"><b>

Don't forget to visit these other top game sites: <a href="http://www.psxgamer.com" target="_blank">PSXGamer.com</a> | <a href="http://www.gamingupdate.com" target="_blank">GamingUpdate.com</a> | <a href="http://www.vgarena.com" target="_blank">VGArena.com</a>

</b></font></font>

</td>

<td align="right" valign="bottom">



</td></tr></table>

</td>

</tr>

<tr>

<td colspan="2" bgcolor="#000000" height="70">

<table width="100%"><tr><td align="center" valign="middle">

<!--Super Cheats General Content Page 120x60-->

<iframe width=120 height=60 marginwidth=0 marginheight=0 frameborder=0 bordercolor=000000 scrolling=no

src="http://adserver.ugo.com:80/html.ng/cat=games&cat2=games&page=111&site=supercheats&size=120x60">



<script language="javascript1.1"

src="http://adserver.ugo.com:80/js.ng/params.richmedia=yes&cat=games&cat2=games&page=111&site=supercheats&size=120x60">

</script>



<noscript>

<a href="http://adserver.ugo.com:80/click.ng/params.richmedia=yes&UID=$random$&cat=games&cat2=games&page=111&site=supercheats&size=120x60">

<img src="http://adserver.ugo.com:80/image.ng/params.richmedia=yes&UID=$random$&cat=games&cat2=games&page=111&site=supercheats&size=120x60" border=0></a>

</noscript>

</iframe>



<img src="http://www.supercheats.com/images/space20.gif">


<!--SuperCheats General Content Page 468x60-->

<!-- AdSpace Network=ugo size=728x90 adtype=over affiliate=videogamernetwork suba=gamingupdate channel=games subchannel=xbox category=tic PT=hp CR=ti pez=tic --> <iframe width=728 height=90 marginwidth=0 marginheight=0 frameborder=0 bordercolor=000000 scrolling=no src="http://mediamgr.ugo.com:80/html.ng/Network=ugo&size=728x90&adtype=over&affiliate=videogamernetwork&suba=gamingupdate&channel=games&subchannel=xbox&category=tic&PT=hp&CR=ti&pez=tic"><script language="javascript1.1" src="http://mediamgr.ugo.com:80/js.ng/params.richmedia=yes&Network=ugo&size=728x90&adtype=over&affiliate=videogamernetwork&suba=gamingupdate&channel=games&subchannel=xbox&category=tic&PT=hp&CR=ti&pez=tic"></script><noscript><a href="http://mediamgr.ugo.com:80/click.ng/params.richmedia=yes&Network=ugo&size=728x90&adtype=over&affiliate=videogamernetwork&suba=gamingupdate&channel=games&subchannel=xbox&category=tic&PT=hp&CR=ti&pez=tic"><img src="http://mediamgr.ugo.com:80/image.ng/params.richmedia=yes&Network=ugo&size=728x90&adtype=over&affiliate=videogamernetwork&suba=gamingupdate&channel=games&subchannel=xbox&category=tic&PT=hp&CR=ti&pez=tic" border=0></a></noscript></iframe><!-- /AdSpace -->

</script>



<noscript>



</noscript>

</iframe>

</td></tr></table>

</td>

</tr>

<tr>

<td colspan="2" bgcolor="#666666">

<table width="100%">

<tr>

<td align="left" valign="top">

<font face="verdana, arial"><font size="-2"><b>

<a href="http://www.supercheats.com/home.htm">Home</a>|

<a href="http://www.supercheats.com/playstation.htm">Playstation</a>|

<a href="http://www.supercheats.com/playstation2.htm">Playstation 2</a>|


<a href="http://www.supercheats.com/nintendo64.htm">Nintendo 64</a>|

<a href="http://www.supercheats.com/gameboy.htm">Gameboy</a>|

<a href="http://www.supercheats.com/pc.htm">PC</a>|

<a href="http://www.gamingupdate.com/forums">Message Board</a>|

<a href="http://www.supercheats.com/submitstuff.htm">Submit Stuff</a>|

<a href="http://www.supercheats.com/bookmarkus.htm">Bookmark Us</a>|

<a href="http://www.supercheats.com/linktous.htm">Link To Us</a>|

<a href="http://www.supercheats.com/links.htm">Links</a><br>

<a href="http://www.supercheats.com/cgi-bin/ubbcgi/memberlist.cgi">Memberlist</a>|

<a href="http://www.supercheats.com/cgi-bin/ubbcgi/memberlist.cgi?sortby=4">Top 25 Posters</a>|

<a href="http://www.supercheats.com/cgi-bin/ubbcgi/team.cgi">Moderator Profiles</a>|

<a href="http://www.supercheats.com/cgi-bin/ubbcgi/Ultimate.cgi?action=lostpw">Password Reminder</a>

</td>

</tr>

</table>

</td>

</tr>

</table>
<center>
<table border=0 width=95%>
<tr>
<TD>

<A HREF="http://www.gamingupdate.com/forums"><IMG SRC="http://gamingupdate.com/forums/SC/messageboardsmall.gif" BORDER=0></A>

</td>
<td align=center>
<B><FONT SIZE="3" FACE="Verdana, Arial" COLOR="#ffffff">SuperCheats.com Forums</FONT></B>

<br><FONT SIZE="1" FACE="Verdana, Arial">
<A HREF="http://gamingupdate.com/forums/profile.php?do=editprofile"><ACRONYM TITLE="Click here to edit your profile.">profile</ACRONYM></A> | <A HREF="http://gamingupdate.com/forums/register.php"><ACRONYM TITLE="Registration is free!">register</ACRONYM></A> | <A HREF="http://gamingupdate.com/forums/profile.php?do=editoptions"><ACRONYM TITLE="Set your preferences.">preferences</ACRONYM></A> | <A HREF="http://gamingupdate.com/forums/faq.php" target=_blank><ACRONYM TITLE="Frequently Asked Questions">faq</ACRONYM></A>

</FONT>
</td></tr>
</table>
</center>
<center>

<table cellpadding=0 border=0 width="95%">
<tr>
<td><FONT SIZE="1" FACE="Verdana, Arial"> </FONT>
</td>
<td valign=bottom align=right><FONT SIZE="1" FACE="Verdana, Arial">Registered Members: <B>1135</B></font></td>
</tr>
<tr>
<td valign=bottom align=left>
<FONT SIZE="1" FACE="Verdana, Arial"></font>
</td>
<td valign=bottom align=right><FONT SIZE="1" FACE="Verdana, Arial">$totalonline peeps browsing the board now!</font></td></tr>
</table>




<hr />


the part im talking about is at the very bottom with the $totalonline. I put it under the "<!-- content table -->
$spacer_open

$_phpinclude_output"

figuring that needed to be before, otherwise it wont work. :/

help please :)

Tuk4
01-12-2007, 03:26 PM
hmmz.. where did you define that var?

imported_Psybadek
01-12-2007, 08:31 PM
It was defined in the FORUM HOME template, otherwise I dont know what to do

Kirk Y
01-12-2007, 10:29 PM
If you're going to use a variable in the "header" template, you need to create a plugin at "global_start" with the contents of your variable, ie: $var = "hello world!";.

If you're using it on the "forumhome" template, then you can change the hook location to "forumhome_start".

Michael Morris
01-12-2007, 10:42 PM
Addendum - if you are displaying a variable in the header template that gets set in the forumhome you'll need to use the first hook after it is set (most likely forumhome_complete) and then re-eval the header template (innefficient, but avoids code hacks).

Tuk4
01-13-2007, 12:10 AM
Hmmz.. ok so in Forumhome template, and you added it in forumhome_complete template.
and its still not working, mind showing me the plugin?