vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Call a template (https://vborg.vbsupport.ru/showthread.php?t=55875)

TheRaven57 08-04-2003 01:35 AM

Call a template
 
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 01:51 AM

PHP Code:

 <?php

  error_reporting
(7);

require(
'./global.php');

eval(
"dooutput(\"".gettemplate("templatename")."\");");

?>


TheRaven57 08-04-2003 02: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 06: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 Code:

 <?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 07:12 AM

What i did was put the following in member.php:

PHP Code:

// 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 09:25 AM

PHP Code:

// Description here 
if ($action == 'name')

           
$templatesused 'templatename'
           require(
"./global.php"); 
           eval(
"dooutput(\"".gettemplate("templatename")."\");");



SVTBlackLight01 08-04-2003 09:57 AM

I knew someone would jump in who really knew what they were doing. Thanks guys. ;)

Dean C 08-04-2003 11:19 AM

Always use single quotes on strings and double quotes on strings containing variables :)

Makes the script faster...

- miSt

filburt1 08-04-2003 11:33 AM

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 11:46 AM

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 02: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 06: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.


All times are GMT. The time now is 02:08 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02085 seconds
  • Memory Usage 1,735KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete