put that after the template eval but before the final template eval of the page (the print_output one).
I don't do a template eval before the print_output one. Here's what I have:
PHP Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('THIS_SCRIPT', 'chat'); // ################### 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( 'chatmain', 'appletbit', ); // pre-cache templates used by specific actions $actiontemplates = array(); // ######################### REQUIRE BACK-END ############################ chdir('../'); require_once('./global.php'); // ######################## START MAIN SCRIPT ############################ // Guests cannot access RealChat Rooms if ($vbulletin->userinfo['userid'] == '0') { print_no_permission(); } eval('print_output("' . fetch_template('chatmain') . '");'); ?>