PDA

View Full Version : Template issue


Red Blaze
06-13-2006, 01:28 AM
I can't find anything in the search function, but it could be me being panicy and not finding the correct terms. In any case, I'm having a problem with the templates. It gets the main template that I specified in the PHP file, but it doesn't grab the rest that I tell it to. Example:

<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// ##################### DEFINE IMPORTANT CONSTANTS #######################
// change the line below to the actual filename without ".php" extention.
// the reason for using actual filename without extention as a value of this constant is to ensure uniqueness of the value throughout every PHP file of any given vBulletin installation.

define('THIS_SCRIPT', 'test');

// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array(
// change the lines below to the list of actual templates used in the script
'cs_chat',
'cs_second'
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ########################## REQUIRE BACK-END ############################
require_once('./global.php');

// #################### HARD CODE JAVASCRIPT PATHS ########################
$headinclude = str_replace('clientscript', $vbulletin->options['bburl'] . '/clientscript', $headinclude);

// ################################################## ######################
// ######################### START MAIN SCRIPT ############################
// ################################################## ######################

$navbits = array();
// change the line below to contain whatever you want to show in the navbar (title of your custom page)
$navbits[$parent] = 'Test Page';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');

// change the line below to contain the name of the actual main output template used in your script
eval('print_output("' . fetch_template('cs_chat') . '");');

?>

It grabs cs_chat, but it won't grab cs_second. I don't know what other changes I've might of missed, but this is my first attempt at creating a vBulletin hack from scratch. Thank you!

Note: I did use this from a tutorial, so this isn't all my coding. :p

Cap'n Steve
06-13-2006, 06:48 AM
It grabs it from the database, but you never do anything with it. You need something like this before you use print_output()

eval('$cs_second = "' . fetch_template('cs_second') . '";');

You then use the $cs_second variable in the cs_chat template.

Red Blaze
06-13-2006, 01:16 PM
So I have to do that with every template I create for this page?

And that didn't seem to work. Unless I put the eval in the wrong spot. ._.'
http://www.chaossanctum.com/forums/test.php

Nvm, I got it. I used this:
eval('$cs_second = "' . fetch_template('cs_second') . '";');

And it worked. Thank you! ^_^

Cap'n Steve
06-14-2006, 04:00 AM
Yeah, I had a typo, but I think you got the idea.