Tag Archives: codeigniter tutorials
To load library in codeigniter view
You can load library in codeigniter view or anywhere using this trick.
go to – system/helpers/url_helper.php
Add the following function :
function loadLibrary($libraryName)
{
$ci = & get_instance();
$ci->load->library->($libraryName);
return $ci->$libraryName;
}
Now in your view Or any where you want to load library just call this function :
example in sample_view.php we have to load library :
just call the function :
loadLibrary(‘library_name’);
how to load model in view codeigniter
How to load model in view codeigniter
You can load models in Codeigniter view as :
Example :
$this->load->model(‘product’);
$result =$this->product->productList();
foreach($result as $row) {
echo $row[‘product_name’];
}
Remove index.php in codeigniter
There are only two changes required to Remove index.php in codeigniter.
1. Config.php change.
2. Add code in .htaccess file placed at the root of your application.
Remove index.php in codeigniter
Add the above following code in .htaccess file to Remove index.php in codeigniter.
RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]
And
go to application/config.php
and change :
$config['index_page'] = 'index.php';
to
$config['index_page'] = '';
Or You Can Use Also :
DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
.htaccess is placed at the root of your application.
After Adding the above changes index.php will be removed in codeigniter.
Download Codeigniter
codeigniter’s latest stable version is V 2.2.0(Current Version). You can download it from
https://ellislab.com/codeigniter/user-guide/installation/downloads.html
You can also download it from github
What is Codeigniter?
CodeIgniter is an open source rapid development web application framework, for use in building dynamic web sites with PHP. The first version was released on February 28, 2006
The latest & stable version of codeigniter is 2.2.0
Codeigniter is very good for rapid application development with small footprints. Codeigniter has good documentation.