library or libraries are collections and functions provided by CodeIgniter. past library CodeIgniter provides functions here that can be used when creating websites. For example library for access to the database, library send Email, library for validation entry and other.
To use a library, the library must first be loaded into the controller that will use it.
$this -load -library(‘[nama_library]’);
For example if you want to use Library validation so library It must beload First.
$this -load -library(‘validation’);
If you want me-Load a number of library at the same time can be done by inserting into an array.
$this -load -library(array(‘[library1]’,’library2’));
For example, do you want toLoad validation library and date so.
$this -load -library(array(‘validation’,’date’));
Apart from-load manually Controllers, libraries that you want to use can also beload automatically so that it can be used on all Regulator by adding it to the array in the autoload.php file
$autoload['libraries'] = array();
example for Load validation library and date automatically.
$autoload['libraries'] = array(‘validation’,’date’);
The following is an example of the use of the library and the helper in the following program excerpts:
1. The first step is to Files by doing Regulator by name welcome.php.
2. Then enter the following program section in the file welcome.php.
load->helper('html'); //fungsi untuk memanggil helper html $list = array( 'red', 'blue', 'green', 'yellow' ); $this->load->library('table'); //fungsi untuk memanggil libary table $tmpl=array('table_open'=>'
3. When the controller welcome.php has been formed, now it’s time to create a file view_htm.php in the folder View.
Nama :List Warna :
4. Now open your browser and enter the URL http: // localhost / CI /. If successful, you will see a page like this:
Well, that’s the benefit of using it helper and library when creating the page website on code detonator. In summary, it can be said that using the Codeigniter framework can simplify and reduce working hours programmer in the making Web pages.