Desidero che il mio error_404.php venga visualizzato nelle visualizzazioni del modello del mio sito. Ho esteso la classe CI_Exceptions (MY_Exceptions) e ho sovrascritto i metodi show_404() e show_error(). Ora quello che voglio fare è essere in grado di caricare un file di visualizzazione lì. In modo ottimale, vorrei caricare i metodi _header() e _footer() nella classe MY_Controller. Questo è possibile in qualche modo?CodeIgniter - Uso load-> view() in Exceptions
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;
}
}
Ma io non posso fare questo. Eventuali suggerimenti?
parent :: __ construct(); dovrebbe essere padre :: CI_Exceptions; – shin
@shin - non in PHP5, penso. –