CodeIgniter Forums
Loading an application level view from within a module controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Loading an application level view from within a module controller (/showthread.php?tid=49446)



Loading an application level view from within a module controller - El Forum - 02-20-2012

[eluser]JustinWyllie[/eluser]
Hi

I have application controllers and views and module controllers and views.

I want to place a general error template (view) at the application layer but load this whenever an error occurs in any module controller.

In the module controller I do this:

$this->self->view('error');

but I get the error message:

Unable to load the requested file application/modules/mymodulename/views/error.php because, of course, it is looking for the view to match the (module) controller.

The template I want to use exists here:

application/views/default/error.php.

How can I load it from within my module controller?

Thanks

-JustinWyllie




Loading an application level view from within a module controller - El Forum - 02-20-2012

[eluser]InsiteFX[/eluser]
Code:
$CI =& get_instance();

$CI->load->view('your_view');