CodeIgniter Forums
Accessing $this->load->view from global functions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Accessing $this->load->view from global functions (/thread-2444.html)



Accessing $this->load->view from global functions - El Forum - 08-06-2007

[eluser]koniciwa[/eluser]
Need help accessing $this->load->view from a global function (which isn't in a class). A sort of wrapper function that saves me from typing $this->something. As expected, $this doesn't work outside a class.
Thanks in advance Smile


Accessing $this->load->view from global functions - El Forum - 08-06-2007

[eluser]Phil Sturgeon[/eluser]
Code:
$CI =& get_instance();
$CI->load->view('blerf');



Accessing $this->load->view from global functions - El Forum - 08-06-2007

[eluser]koniciwa[/eluser]
Thanks mate! Works like a charm... didn't know it could work outside the 'libraries' context.