1
votes

I have problem with css file in CodeIgniter framework. In my autoconfig file I load url and html helper. In view I have code:

<?php echo link_tag('application/assets/css/style.css')?>

but this code doesn't work. In config file my base_url is http://localhost/CI. My directory structure is

-application -assets -css -views -partials -home I try

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

or

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

but this also doesn't work.

3
You can't put your asset folder in application folder.parth
So assets folder must be in root directory?molnard
move assets outside the applciationdevpro

3 Answers

2
votes

Put your asset folder in project root, out side application folder.

Change the link to,

<?php echo link_tag('assets/css/style.css')?>

CI Folder Structure

enter image description here

1
votes

You need to use assets folder outside the application folder, something like:

enter image description here

Than you can call like:

<?php echo link_tag('assets/css/style.css');?>
0
votes

I think you do not remove index.php from url so you should set address for css like this :

<?php echo site_url('assets/css/style.css')?>