CodeIgniter Forums

Full Version: Accessing $this->load->view from global functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

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

El Forum

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