Tuesday, 18 February 2014

How to add assets in CodeIgniter

When you are creating a Web Application with CI, you work with assets

you can create a "assets" folder in the root folder

To activate it

Step 1: Create Application Helper

function asset_url(){
   return base_url().'assets/';

Step 2: application/config/autoload.php:
$autoload['helper'] = array('url','utility');

After this you can very well use asset_url(); with in your application

How to remove index.php from url in code igniter

Create a .htaccess file in root directory and

Copy paste this code
RewriteEngine on

RewriteCond $1 !^(index\.php|assets|robots\.txt)

RewriteRule ^(.*)$ index.php/$1 [L]
where assets is the folder in the root directly containing all your assets Ref