Welcome Guest, Not a member yet? Register   Sign In
loading helpers inside views
#3

[eluser]PhilTem[/eluser]
The title is a little misleading, but to answer your question: Helpers are actually wrappers for views to call functions from libraries, models, or the controller. Since you don't want to have something like

Code:
echo $this->input->post('field_name');

in a view but something like

Code:
echo post_value('field_name');

is okay to have. This is also important since you can't ensure that the scope of $this in the view is the same as in the controller (i.e. the CI super object).

Using helpers in your view code is good and suggested, using them in libraries or the controller is okay, as long as these helpers are generic helpers, i.e. don't manipulate or use the CI super-object. (That's all imho)


Messages In This Thread
loading helpers inside views - by El Forum - 12-24-2012, 12:42 AM
loading helpers inside views - by El Forum - 12-24-2012, 06:44 AM
loading helpers inside views - by El Forum - 12-24-2012, 07:24 AM
loading helpers inside views - by El Forum - 12-24-2012, 10:39 AM
loading helpers inside views - by El Forum - 12-24-2012, 11:11 AM
loading helpers inside views - by El Forum - 12-24-2012, 03:50 PM
loading helpers inside views - by El Forum - 12-24-2012, 06:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB