EllisLab text mark
Advanced Search
     
including CSS - failure :(
Posted: 30 November 2009 06:56 PM   [ Ignore ]
Joined: 2009-11-29
99 posts

Hello all, I`m Kris, and I got a problem with including CSS styles into my site.
Further more if I couldn`t put css then I could not put an img file and so on and so on.
Basically, I have

$config['base_url'"http://127.0.0.1/KC_ciTraining/"

I also create a CSS directory i a root direcorty as above

-kc_ciTraining
  -css
    - style.css
  -system
    - application
    - cache
      .
      .
      .
      .
I included my css file like this

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

When I open my site it doesn`t work at all. When I look at site source I get

<link ref="stylesheet" href="http://127.0.0.1/KC_ciTraining/css/style.css" type="text/css" media="all" /> 

 
when I put css source directly into my view - works fine. Why? what should I do? Where to put css directory and css file? and finally where to put img direcory.

regards kris
  -user guide

 
Posted: 30 November 2009 07:17 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-16
83 posts

Are you rewriting URLs? If so you may need to exempt the css folder from being rewritten.

Also take a look at using link_tag() (part of the HTML Helper) for this as it automagically prepends the result of base_url():

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

Try to open http://127.0.0.1/KC_ciTraining/css/style.css in your browser to be sure you can even access that file.

 
Posted: 30 November 2009 07:27 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2009-11-29
99 posts

I`m not using rewriting. When I open url as you said I got my css file on screen i webbrowser.

Ok, fine link_tag works well. Thanks.

I made literal mistake in code. Instead of “link rel” I put “link ref” wrrrr

and how to put images on webpage? also using this helper

echo img('images/picture.jpg'); 

and before that creating folder images in root directory??

or base_url?

 
Posted: 30 November 2009 07:49 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-16
83 posts
john_doe - 01 December 2009 12:27 AM

I`m not using rewriting. When I open url as you said I got my css file on screen i webbrowser.

Ok, fine link_tag works well. Thanks.

I made literal mistake in code. Instead of “link rel” I put “link ref” wrrrr

and how to put images on webpage? also using this helper

echo img('images/picture.jpg'); 

and before that creating folder images in root directory??

or base_url?

You are spot on with img() smile Cheers and good luck.