Custom navigation for 404 page
I am using some custom templates. It seems that for 404 pages(if I write something wrong in url - a function name that doesn't exist in the controller) I get errors like:
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: menu
Filename: _blocks/navigation.php
Line Number: 17
How should I send $menu variable for 404 pages? If I comment the line than I will get further errors like:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Page_router::$auth
Filename: _blocks/navigation.php
Line Number: 38
Fatal error: Call to a member function is_logged_in() on a non-object in ...\fuel\application\views\_blocks\navigation.php on line 38
The code from navigation.php which gives the last error is :
<?php if ($this->auth->is_logged_in()) { ?>
<?php } ?>
Comments
If you create a view file of "404_error" or a page in the CMS of 404_error it will be used instead of the default CI 404 error page if the function redirect_404() is called instead of show_404(), which is done by default with FUEL.
added in fuel/application/views/_variables/global.php
$vars['CI'] = &get_instance();
$CI->load->library('navigation');
$vars['menu'] = $CI->navigation->menu_items();
$vars['submenu'] = $CI->navigation->submenu_items();