Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 01-12-2007, 09:26 AM
imported_Psybadek imported_Psybadek is offline
 
Join Date: Nov 2003
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to get PHP to work in the header in vBulletin

Im trying to use the $totalonline php variable in the header, but it wont work, here what I got.

PHP Code:
<!-- 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 == -1end dc.length;
            return 
unescape(dc.substring(beginend));        }
}
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>
[b]<td valign=bottom align=right><FONT SIZE="1" FACE="Verdana, Arial">$totalonline peeps browsing the board now!</font></td></tr>[/b]
</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
Reply With Quote
  #2  
Old 01-12-2007, 03:26 PM
Tuk4 Tuk4 is offline
 
Join Date: Feb 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmz.. where did you define that var?
Reply With Quote
  #3  
Old 01-12-2007, 08:31 PM
imported_Psybadek imported_Psybadek is offline
 
Join Date: Nov 2003
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It was defined in the FORUM HOME template, otherwise I dont know what to do
Reply With Quote
  #4  
Old 01-12-2007, 10:29 PM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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".
Reply With Quote
  #5  
Old 01-12-2007, 10:42 PM
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Location: Knoxville TN
Posts: 774
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #6  
Old 01-13-2007, 12:10 AM
Tuk4 Tuk4 is offline
 
Join Date: Feb 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmz.. ok so in Forumhome template, and you added it in forumhome_complete template.
and its still not working, mind showing me the plugin?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:12 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.03966 seconds
  • Memory Usage 2,281KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete