Quote:
Originally Posted by Lynne
Actually, you need to name the template whatever you have called it in this line of your php file:
PHP Code:
define('THIS_SCRIPT', 'test');
and again called in this line:
PHP Code:
$templater = vB_Template::create('mytesttemplate');
According to the first line, you need to name the template "test". If you name it anything else, then it won't work. So, I think Mark corrected the template name on one line, but not the other. Both of those should be the same.
|
I have always used one name for the script, and then other names for the templates rendered by the script. As long as the templates are specified in the $globaltemplates array, then they can be rendered without issue, at least that's been my experience.
For example, here's a very simple script I coded a while back for someone:
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'inremembrance');
define('CSRF_PROTECTION', true);
// ################### 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('markfl_inremembrance');
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
// ###### YOUR CUSTOM CODE GOES HERE #####
$navbits = construct_navbits(array('' => $vbphrase['markfl_inremembrance_pagetitle']));
$navbar = render_navbar_template($navbits);
$pagetitle = $vbphrase['markfl_inremembrance_pagetitle'];
// ###### NOW THE TEMPLATES ARE BEING RENDERED ######
$templater = vB_Template::create('markfl_inremembrance');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
print_output($templater->render());
?>