The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
A bit confused about new hooks calls
Hi, i'm little confused about using template hooks in vB 4, so i just ask here for little help. Hope someone helps me
On vB 3.8.x i had a little server status check in navbar. Template edit was: Code:
[ SERVER1 status: $status1 | SERVER2 status: $status2 ]<br /> Product: vBulletin Hook location: global_start Code:
include "/var/www/mysite.com/misc/serverstatus.php"; $server1=$serverstat1; $server2=$serverstat2; $status1=""; $status2=""; if ($server1 == 1) { $status1="<font color=green>ONLiNE</font>"; } else{ $status1="<font color=red>OFFLiNE</font>"; } if ($server2 == 1) { $status2="<font color=green>ONLiNE</font>"; } else{ $status2="<font color=red>OFFLiNE</font>"; } But now, on vB 4, it just looks like: [ SERVER1 status: $status1 | SERVER2 status: $status2 ] So i miss something and i cant figure out what ... Thanks in advance for help Holy |
#2
|
|||
|
|||
Any help please?
|
#3
|
|||
|
|||
You probably haven't registered the variables and used the new variable syntax in the template. Download a vB4 mod and look at how they register variables.
|
#4
|
|||
|
|||
change $status1 to <vb:var status1> in the template. You'll also need to pre-register them to the navbar.
|
#5
|
|||
|
|||
Thanks, now it is ok, but it ignores html tags :/
My PHP: Code:
include "/var/www/mysite.com/files/status.php"; $server1=$serverstat1; $server2=$serverstat2; $status1=""; $status2=""; if ($server1 == 1) { $status1='<font color="green">ONLiNE</font>'; } else{ $status1='<font color="red">OFFLiNE</font>'; } if ($server2 == 1) { $status2='<font color="green">ONLiNE</font>'; } else{ $status2= '<font color="red">OFFLiNE</font>'; } vB_Template::preRegister('navbar', array('status1' => $status1)); vB_Template::preRegister('navbar', array('status2' => $status2)); Template mod is: Code:
[ SERVER1 status: {vb:var status1} | SERVER2 status: {vb:var status2} ]<br /> <br /> <!-- TwinStar server status - END --> And it shows as: [ SERVER1 status: <font color=green>ONLiNE</font> | SERVER2 status: <font color=green>ONLiNE</font> ] Any ideas? Thanks |
#6
|
|||
|
|||
The font tag has been deprecated since 1996. Use CSS to achieve the colour effect instead.
|
#7
|
|||
|
|||
Yep, i know and i tried CSS too, but same problem. For example
Code:
if ($server1 == 1) { $status1='<div style="color: #00FF00">ONLiNE</div>'; } So i think, there are some restrictions or something with that var pre-register, because if i use this on normal PHP, everything is fine, so the script is fine. |
#8
|
||||
|
||||
What are you using in the template? {vb:raw status1}?
From Wayne's article: Quote:
|
#9
|
|||
|
|||
A million thanks for Lynne! That three chars almost killed me. Now it works perfect!
I'll send some Tequilla shots to California ^^ |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|