How to create custom library in CodeIgniter
We are normally referring to the classes that are located in the libraries directory.
You can create your own libraries within your application/libraries directory.
Here
If You want to create library . then it place in application/libraries in codeigniter .
When you create new library there 3 thing for naming conversion.
- File names must be capitalized. For example: Myexample.php
- Class declarations must be capitalized. For example: class
Myexample - Class names and file names must match
Example OF custom library
<? php if ( ! defined ( 'BASEPATH')) exit( 'No direct script access allowed'); ?>
<? php
}
}
?>
{
{
$this->load->library( 'pro'); // initialize the library
}
}
?>
$this->load->library( 'pro'); // initialize the library
}
?>
{
$param = array( "color"=>"blue");
$this->load->library( 'pro');
$menu = new pro;
$data[ 'menu'] = $menu->show_menu( );
}
0 komentar:
Post a Comment