View Full Version : Including files in the template code?
Hillard Malkeme
10-06-2004, 12:58 PM
Just to let you know I'm new to vbulletin. They guy we had setting up our forums is no longer with us so I have to pick up the slack. Well I've built a site that uses it's own include files for header,Navigation and a few others. The problem is I can't use the code I wrote for the site in the template.
Here is my code for my site that I would like to add into my template.
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="">
<TITLE>Pride Web Talk</TITLE>
<link rel='stylesheet' href='/Skins/Default/Default.css' type='text/css' />
</HEAD>
<BODY>
<?php include("Header.php");?>
<TABLE WIDTH=100% HEIGHT=75% BORDER=0 CELLSPACING=3 CELLPADDING=3>
<TR>
<TD valign=top width=130>
<?php include("./Nav.php");?><BR>
<?php include("./SiteStats.php");?>
</TD>
<TD align=center valign=top class="MainBody">
How can I add this code in my template and get it to work? I've tried searching but didn't find what I was looking for. Again I'm new to vbulletin so I may have found it and didn't know it.. :devious:
Dean C
10-06-2004, 01:03 PM
Questions about modifying vBulletin's default behaviour and asking about modifications in general, should be posted in General vBulletin Questions. Please read the forum descriptions more carefully in future. I've moved your thread there for you :)
Thanks,
- Dean
Colin F
10-06-2004, 01:18 PM
Well, first off, you won't be able to use php for sure in the templates.
The only templates that will parse php code are the phpinclude_start and _end templates.
I would check into replacing your templatecode with the html in the header and navbar template.
Hillard Malkeme
10-06-2004, 01:55 PM
Well, first off, you won't be able to use php for sure in the templates.
The only templates that will parse php code are the phpinclude_start and _end templates.
I would check into replacing your templatecode with the html in the header and navbar template.
So you are saying if I build a page using php (or ASP) I can't use it as a template for the forums?
How about I build everything with functions to either echo or return my HTML code. Can I include that file to one of the vbulletin php pages (Like global.php) and call the functions from inside the template code?
So if I had this function
function OnlineCount(){
$datecut=Time()-900; //900 = last 15 minutes
$sql = "SELECT COUNT(*) AS sessions FROM session WHERE lastactivity >$datecut";
$result = mysql_query($sql);
$fieldvalue = mysql_fetch_row($result);
return number_format($fieldvalue[0], 0, ".",",");
}
Could I call the function from the template code to display my return?
Colin F
10-06-2004, 02:00 PM
What you would have to do is call the function and save it to a variable, which you can then call from the template.
so, in the *.php:
$online = OnlineCount();
and in the template just use $online
Hillard Malkeme
10-06-2004, 02:04 PM
What you would have to do is call the function and save it to a variable, which you can then call from the template.
so, in the *.php:
$online = OnlineCount();
and in the template just use $online
Ok I understand. Any suggestion on where I should include my php page with all my functions? Would global.php be my best bet?
And thank you for the help..
Colin F
10-06-2004, 02:52 PM
global.php as well as functions.php are both loaded on every page.
Either should work
Hillard Malkeme
10-06-2004, 03:04 PM
Thank you Colin..
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.