How to include footer and header in error/html/error_404.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: How to include footer and header in error/html/error_404.php (/showthread.php?tid=69501) |
How to include footer and header in error/html/error_404.php - amitkalhan - 12-05-2017 I can print the base url at error/html/error_404.php by adding following code:- <?php defined('BASEPATH') OR exit('No direct script access allowed'); ?> <?php $ci = new CI_Controller(); $ci =& get_instance(); $ci->load->helper('url'); ?> But couldn't include my header and footer (Located at: [b]views/include/footer.php) in error/html/error_404.php[/b] RE: How to include footer and header in error/html/error_404.php - bvrignaud - 12-05-2017 You can use : include_once 'header.php' RE: How to include footer and header in error/html/error_404.php - PaulD - 12-05-2017 I could be wrong here, but I think the error pages are supposed to be, pretty much, completely stand alone pages, so that they do not rely on your normal header and footer code, avoiding possible loops in case the error is actually caused by something in your footer or header. I usually add a hardcoded link back to the home page, as well as the standard header and message, but nothing more. |