Welcome Guest, Not a member yet? Register   Sign In
Helper and Library
#1

[eluser]$ilovephp[/eluser]
Can anyone clearly distinguish how Helper differ from Library?

Both are classes, but I can't comprehend to differentiate the two.

Any thoughts is greatly appreciated. Thank you.
#2

[eluser]adamp1[/eluser]
A Helper is not a class. A helper is a file with php functions in it. A library is as you said a class.
#3

[eluser]$ilovephp[/eluser]
Woah! Thanks for that information adamp1.

Can you elaborate more about their difference in functionalities or use?

Thanks!
#4

[eluser]adamp1[/eluser]
Libraries
When we use the term "Libraries" we are normally referring to the classes that are located in the libraries directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create your own libraries within your application/libraries directory in order to maintain separation between your local resources and the global framework resources.

As an added bonus, CodeIgniter permits your libraries to extend native classes if you simply need to add some functionality to an existing library. Or you can even replace native libraries just by placing identically named versions in your application/libraries folder.
More info http://ellislab.com/codeigniter/user-gui...aries.html

Helpers
Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category. There are URL Helpers, that assist in creating links, there are Form Helpers that help you create form elements, Text Helpers perform various text formatting routines, Cookie Helpers set and read cookies, File Helpers help you deal with files, etc.

Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions. Each helper function performs one specific task, with no dependence on other functions.

CodeIgniter does not load Helper Files by default, so the first step in using a Helper is to load it. Once loaded, it becomes globally available in your controller and views.

Helpers are typically stored in your system/helpers, or system/application/helpers directory. CodeIgniter will look first in your system/application/helpers directory. If the directory does not exist or the specified helper is not located there CI will instead look in your global system/helpers folder.
http://ellislab.com/codeigniter/user-gui...lpers.html
#5

[eluser]$ilovephp[/eluser]
Wow! Very well said. Thank you very much for the informative reply.




Theme © iAndrew 2016 - Forum software by © MyBB