Welcome Guest, Not a member yet? Register   Sign In
How can i load a library file in a helper file?
#4

[eluser]MMacdonald[/eluser]
What are you trying to achieve here? Helpers are meant to be small, procedural functions for carrying out simple tasks.

The syntax below works, but I'm not convinced that calling libraries within helpers is "good practice". I'd be interested to know other peoples' opinions.

Controller

Code:
function index()
{
  example_helper($this);
}

Helper

Code:
function example_helper($controller_name)
{
  $controller_name->load->library('calendar');
  echo $controller_name->calendar->generate(2006, 6);
}


Messages In This Thread
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 06:48 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 06:57 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 06:59 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 07:10 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 07:19 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 07:19 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 07:38 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 07:54 AM
How can i load a library file in a helper file? - by El Forum - 11-07-2008, 08:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB