0

Possible Duplicate:
CodeIgniter - Loading CSS

I try load css file and it's not work. this is the link tag:

<link rel="stylesheet" type="text/css" href="application/styles/style.css" />

how i can do this?

Community
  • 1
  • 1
nirbe
  • 19
  • 6

1 Answers1

0

Make a folder outside the application folder Eg: resources/css/style.css and link it like below.

Then the folder structure will be like this,

-application
-resources
-system
-index.php

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>resources/css/styles/style.css" />
Shaolin
  • 2,541
  • 4
  • 30
  • 41
  • it's not work. base_url not work... – nirbe Sep 27 '12 at 06:03
  • @user1702278 you have to declare it before using it..open `application/config/config.php` to change your `base_url()` – Bhuvan Rikka Sep 27 '12 at 06:04
  • 1
    when you echo base_url(); what does it show? nothing? did you define $config['base_url'] in the config file (application/config/config.php)? – Shaolin Sep 27 '12 at 06:06
  • i change and it's dont work: Fatal error: Call to undefined function base_url() in C:\Program Files\EasyPHP-12.1\www\LearnIL\application\views\layout\header.php on line 16 – nirbe Sep 27 '12 at 06:06
  • how did you define the $config['base_url']? it should be like this if you are using localhost, $config['base_url'] = 'http://localhost/your_app/' – Shaolin Sep 27 '12 at 06:09
  • $config['base_url'] = 'http://127.0.0.1:8090/LearnIL/'; – nirbe Sep 27 '12 at 06:10
  • you have to load the url_helper. $autoload['helper'] = array('url'); That's in application/config/autoload.php – Shaolin Sep 27 '12 at 06:11
  • now it's work, but i do this: and it's not work. – nirbe Sep 27 '12 at 06:14
  • View you page source and copy the link and past it onto the browser and check where does it go. Check if the generated link is correct. – Shaolin Sep 27 '12 at 06:19
  • This is because the. Htaccess, bow it's work, i do this now: RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico|uploads|media|assets), and it's work. tnx! – nirbe Sep 27 '12 at 06:22
  • ok. good, if your problem resloved, don't forget to mark as answer – Shaolin Sep 27 '12 at 06:25