CodeIgniter Forums
Accessing $this->load->view from global functions - 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: Accessing $this->load->view from global functions (/showthread.php?tid=2444)



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.