Welcome Guest, Not a member yet? Register   Sign In
Helpers
#1

[eluser]Unknown[/eluser]
Hi,


Very new to both PHP and CI, however one question I beg someone answers.

Everything such as Loaders etc are OOP, but why are Helpers plain functions?

I mean, surly the code would look cleaner if in the view files, the helpers would be accessed through $helper->function(); as apposed to just function()?

Seems like it could become confusing if later on you modify the helper, and then have to go through every function within the view files making sure they’re compatible.
#2

[eluser]Michael Wales[/eluser]
Helpers are just functions so as they are not limited within their scope. Helpers may be used in either the Controller or View.

Plus, it's less to type. Smile
#3

[eluser]Colin Williams[/eluser]
Sometimes there's a reason to use classes. Sometimes there isn't.




Theme © iAndrew 2016 - Forum software by © MyBB