View Full Version : does php work in templates
Samish
12-12-2009, 08:51 PM
i need to add a php script into one of my templates does it work? or how can i make it work?
Lynne
12-12-2009, 08:56 PM
You cannot add php to templates. You add the php to plugins and then put the output into the templates via a variable.
Samish
12-12-2009, 08:59 PM
urrm tht made no sense haha
could you help i need to put this in there
<?php
include("path/to/show_rares.php");
?>
Adrian Schneider
12-12-2009, 09:04 PM
Which template?
You'd put something like this into a plugin (hook depends on template) :
ob_start();
include('path/to/show_rares.php');
$rares = ob_get_clean();And stick $rares in your template.
global_start works for a lot of the templates if they use global scope and aren't evaluated before this hook.
Samish
12-12-2009, 09:06 PM
i have no clue what you just said, basically i need that code to work in this template
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header
$navbar
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">RARE VALUES</td>
</tr>
<tr>
<td class="alt1">
</td>
</tr>
</table>
$footer
</body>
</html>
Its a new page i just created :)
If you can help it would be great
Lynne
12-12-2009, 09:09 PM
If it's a new page, then you don't need to put code in a plugin. You put the php code into your page that you just created. It's php which goes into the php page.
Samish
12-12-2009, 09:12 PM
If it's a new page, then you don't need to put code in a plugin. You put the php code into your page that you just created. It's php which goes into the php page.
how do you mean?
i followed that guide you gave me. and ive made the .php and linked it to the template... now what
Lynne
12-12-2009, 09:48 PM
The article gives you the skeleton of what you need. You now enter your code under the are that says "START MAIN SCRIPT". And then the output from that should be a $variable and you put that $variable into your template.
If you look at a basic vbulletin page, you will see them do this.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.