मैं अपनी साइट टेम्पलेट दृश्यों में दिखाने के लिए मेरी त्रुटि_404.php चाहता हूं। मैंने सीआई_एक्सप्शन क्लास (MY_Exceptions) बढ़ाया है और show_404() और show_error() विधियों को ओवरराइड किया है। अब मैं जो करना चाहता हूं वह वहां एक व्यू फाइल लोड करने में सक्षम है। सबसे अच्छा, मैं MY_Controller क्लास में _header() और _footer() विधियों को लोड करना चाहता हूं। क्या यह किसी भी तरह से संभव है?कोडइग्निटर - अपवादों में लोड-> देखें() का उपयोग
class MY_Exceptions extends CI_Exceptions {
public function __construct(){
parent::__construct();
}
function show_404($page = '')
{
$heading = "404 Page Not Found";
$message = "The page you requested was not found for some strange reason...";
log_message('error', '404 Page Not Found --> '.$page);
$CI =& get_instance();
$CI->load->view('template/header');
echo $this->show_error($heading, $message, 'error_404', 404);
$CI->load->view('template/footer');
exit;
}
function show_error($message, $status_code = 500)
{
$error =& load_class('Exceptions');
echo $error->show_error('An Error Was Encountered', $message, 'error_general', $status_code);
exit;
}
}
लेकिन मैं यह नहीं कर सकता। कोई सुझाव?
अभिभावक :: __ निर्माण(); माता-पिता होना चाहिए :: सीआई_ अपवाद; – shin
@shin - PHP5 में नहीं, मुझे लगता है। –