View Full Version : How do you use a new template?
The Keeper
03-29-2002, 02:05 AM
Let's say I create a template, then I make a new script somewhere like myScript.php, how do I get that script to use my template?
Are there tutorials?
Also how would I do a PHP include of myScript.php onto the main page somewhere? Normal php code won't work in a template.
eval("\$string = \"".gettemplate("your_template")."\";");
The Keeper
03-29-2002, 02:57 AM
errr...
The Keeper
03-29-2002, 03:08 AM
Don't worry about the template, it's too hard for me to comprehend
but how do I do a php include on the main page?
include('file.php');
and make sure oyu have the global.php in everyone of your php files that connect to vb.
The Keeper
03-29-2002, 06:10 AM
include('file.php');
lol. No that's not it. If it was that simple I wouldn't need to ask, heh.
But do tell what global.php does.
Admin
03-29-2002, 06:23 AM
lol
Place this in your phpinclude template:
ob_start();
require('./file.php');
$filestuff = ob_get_contents();
ob_end_clean();
then use $filestuff in your templates.
The Keeper
03-29-2002, 06:41 AM
awesome! the phpinclude template!! thanks
The Keeper
03-29-2002, 01:05 PM
hi this is what I put in
ob_start();
include("test.php");
$testphp = ob_get_contents();
ob_end_clean();
and it works fine when I include it on the main page.
But for some odd reason when I view Who's Online (even though I didn't include anything there)
I get the following:
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 263
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 264
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 263
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 264
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 263
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 264
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 263
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 264
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 263
Warning: Cannot use a scalar value as an array in /usr/local/plesk/apache/vhosts/gaters.net/httpdocs/online.php on line 264
Now it says the problem is in online.php, but that behaviour is not shown when the phpinclude template is empty.... so am I right in thinking the problem is really in test.php?
What should I look for?
Admin
03-29-2002, 01:11 PM
Does test.php do anything with the variables $post / $userinfo?
The Keeper
03-29-2002, 11:07 PM
It features this:
$post = mysql_query("SELECT * FROM post WHERE threadid = $line[threadid] ORDER BY postid asc LIMIT 1") or die("Query failed");
$thepost = mysql_fetch_array($post, MYSQL_ASSOC);
$thewords = bbcodeparse($thepost[pagetext],0,1);
print($thewords);
Admin
03-30-2002, 05:15 AM
Replace $post with $mypost, that should take care of it. Or remove MYSQL_ASSOC from mysql_fetch_array() so the array can use numeric indexes (I think).
The Keeper
03-30-2002, 08:34 PM
You're the best firefly. :P Thanks a lot.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.