Zarah Hafeez
Zarah Hafeez

Reputation: 37

CSS files issue in CodeIgniter

I'm using CodeIgniter for the first, I added my html files in the views folder & css,jss, images in the assets folder.

Now my css etc not appearing in the layout, kindly let me know how to include/urls?

Thanks!

Upvotes: 0

Views: 79

Answers (2)

Abhijit
Abhijit

Reputation: 941

suppose your css folder path like

example : projectfolder/assets/css/style.css

so in view file you can use below code

<link rel = "stylesheet" type = "text/css" href = "<?php echo base_url(); ?>assets/css/style.css">

Upvotes: 0

Bilal Ahmed
Bilal Ahmed

Reputation: 4066

go to -> your_project->application->config->config.php

open config.php

add base path of your project

$config['base_url'] = 'http://localhost/yourProject/';

and add asset path (img, css, js)

define('ASSET_PATH',$config['base_url'].'assets/');

make sure your all css files in assets folder like this:

assets->css->style.css
assets->js->style.js

and finally used in view

<link href="<?php echo ASSET_PATH; ?>css/style.css" rel="stylesheet">

Upvotes: 2

Related Questions