Log in

View Full Version : Custom 404 Error template problem


rockinaway
09-01-2009, 09:20 AM
I have a custom 404 error page with the following code:

<?php

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', '404error'); // change this depending on your filename

// ################### 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(
'404Error',
);

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

);

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

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

$navbits = array();
$navbits[$parent] = 'Error';

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



// Final output
eval('print_output("' . fetch_template('404Error') . '");');



?>

This is from an article here. Now when I access the page (say from Google to a page that doesn't exist), the templates don't load: http://www.google.com/search?hl=en&safe=off&q=site%3Awww.adminfuel.com&btnG=Search - select the error one.

However, sometimes when I access the page directly from the forum, the templates all load up. What may be the problem?