How to load view in file error_404.php? |
[eluser]Unknown[/eluser]
Hello! At the beginning sorry for my English, but I learn his yet. I have small problem with CodeIgniter. I would like to load view in file errors/error_404.php. So I put in this file code: Code: <?php If i visit on page www.mysite.pl/controller/qwerty (qwerty is any string) all works good. However when I go on page www.mysite.pl/qwerty I have error: Quote:Fatal error: Call to undefined function get_instance() in .../application/errors/error_404.php on line 4 Please help me solve my problem. Greetings from Poland, Paul.
[eluser]abmcr[/eluser]
Have you try with Code: <?php
[eluser]Pascal Kriete[/eluser]
Missing controller 404 errors are thrown before the CI super-object is instantiated. The function get_instance doesn't exist that early in the execution cycle. There are no satisfying workarounds to this problem yet .
[eluser]supahero[/eluser]
that's why i cann't use it. even i have modified on system/codeigniter/Common.php at function function show_404() it still blank to load->view() any luck?
[eluser]supahero[/eluser]
any body help this problem? admin please see this thread. thanks
[eluser]Banana Man[/eluser]
Why dont you just include the files needed, i presume it is mainly static content you'll require, and simply just including files maybe the easiest option ?
[eluser]Banana Man[/eluser]
Code: <?php Just use native php if the system isnt completely initiated yet, also you could develop this further to send yourself an email when these errors occur with $heading and $message
[eluser]Banana Man[/eluser]
remember that path to file will be relative to where index.php is placed, for example ../application/views/_global_nav.php
[eluser]Unknown[/eluser]
In 'application/config/routes.php' just specify the controller and function to be called on a 404. routes.php ---------- Code: $route['404_override'] = 'site/not_found'; Using the above example just put a function called 'not_found' in the controller 'site.php'. Then just load the view you want as usual. site.php -------- Code: public function not_found() |
Welcome Guest, Not a member yet? Register Sign In |