Welcome Guest, Not a member yet? Register   Sign In
including CSS - failure :(
#1

[eluser]Krystian[/eluser]
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

Code:
$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

Code:
<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

Code:
<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
#2

[eluser]markup2go[/eluser]
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():
Code:
<?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.
#3

[eluser]Krystian[/eluser]
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

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

and before that creating folder images in root directory??

or base_url?
#4

[eluser]markup2go[/eluser]
[quote author="john_doe" date="1259641641"]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

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

and before that creating folder images in root directory??

or base_url?[/quote]

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




Theme © iAndrew 2016 - Forum software by © MyBB