php - CodeIgniter: Include a controller outside the application environment -


so basically, load codeigniter controller contents outside codeigniter's environment, is, traditional php page.

i have tried following doesn't suit requirements:

<?php require('/application/controller/error?type=not_found'); ?> 

it gives following error:

message: require(/application/controller/error?type=not_found): failed open stream: no such file or directory 

to clarify, i'm trying change default /application/errors/error_404.php page contents display custom http 404 error page i've built in "error" controller & view.

the problem is, pages under /application/errors/ treated normal php pages codeigniter means can't use $this->load-view('error'); inside error_404.php page.

i appreciate other suggestions ways create custom error pages in codeigniter.

you should set 404 page in route.php page in application/config folder:

 $route['404_override'] = 'your-error-controller/your-error-view'; 

this route tell router uri segments use if provided in url cannot matched valid route.

i might confused @ question routes.php gives place can point 404 page custom view.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -