Can I load a library from inside a helper?
$this->load->library('name');
Thanks, Max
Can I load a library from inside a helper?
$this->load->library('name');
Thanks, Max
No. The purpose of helpers is to "perform one specific task, with no dependence on other functions."
Quoted from CI's helpers page.
If you need to include a library inside of your helper, consider making it a library instead.
// ------------------------------------------------------------------------
/**
* URL String
*
* Returns the URI segments.
*
* @access public
* @return string
*/
if ( ! function_exists('uri_string'))
{
function uri_string()
{
$CI =& get_instance();
return $CI->uri->uri_string();
}
}
Yes, of course.
I disagree with jimyi's answer. CI's own url helper loads the URI class.