View Full Version : Call a template
TheRaven57
08-04-2003, 02:35 AM
I'm new to all of this. I'm installing a "Video Game Cheats" hack. Basically I'm setting it up so that the information is in a template and I'd create an index page that would call the template.
My question is: What is the PHP code that would call the template? Thanks!
SVTBlackLight01
08-04-2003, 02:51 AM
<?php
error_reporting(7);
require('./global.php');
eval("dooutput(\"".gettemplate("templatename")."\");");
?>
TheRaven57
08-04-2003, 03:22 AM
I put exactly what you said (added the template name of course). And I got the following error:
Warning: main(./global.php): failed to open stream: No such file or directory in /home/theraven/public_html/cheats/index.php on line 5
What does that mean?
SVTBlackLight01
08-04-2003, 07:52 AM
It means that index.php is not in the same directory as global.php.
If you want to call the template from outside your forum directory you can try this instead:
<?php
error_reporting(7);
chdir('/path/to/forums/directory/');
require('./global.php');
eval("dooutput(\"".gettemplate("donate")."\");");
?>
You will probably need to make all the header and footer links absolute (/forums/search.php), as well as the path to the images folder, to make everything work correctly.
DiscussAnything
08-04-2003, 08:12 AM
What i did was put the following in member.php:
// Description here
if ($action=="NAME") {
$templatesused = 'templatename';
include("./global.php");
eval("dooutput(\"".gettemplate("templatename")."\");");
}
then , in your forum, just link to member.php?action=NAME and it works. Don't forget to create a template for the templatename tho, with full content (whole page)
Dean C
08-04-2003, 10:25 AM
// Description here
if ($action == 'name')
{
$templatesused = 'templatename';
require("./global.php");
eval("dooutput(\"".gettemplate("templatename")."\");");
}
SVTBlackLight01
08-04-2003, 10:57 AM
I knew someone would jump in who really knew what they were doing. Thanks guys. ;)
Dean C
08-04-2003, 12:19 PM
Always use single quotes on strings and double quotes on strings containing variables :)
Makes the script faster...
- miSt
filburt1
08-04-2003, 12:33 PM
I seriously doubt it makes the script faster than an msec...I always use double-quotes everywhere for consistency except for array keys. :)
TheRaven57
08-04-2003, 12:46 PM
Thanks for your help, I'm having just one more problem.
I'm using index.php to call the template. How do I eliminate the other elements on the page? The template keeps getting generating the index page and then it puts the template stuff at the bottom.
Dean C
08-04-2003, 03:18 PM
Really? Now that is interesting fiburt...
Its a standard conformity with a lot of people I work with :)
- miSt
noppid
08-04-2003, 07:11 PM
Filburt hit me with that "it don't matter" statement too. I just dropped it though as I've seen it matter. Don't want a ++++ing match, but it seems to matter.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.