Welcome Guest, Not a member yet? Register   Sign In
A Strange CSS style issue
#1

[eluser]developer10[/eluser]
Hello,

I'm experiencing a strange issue with my css file.
i'm not having this problem on my localhost, it occurred after i uploaded the site to server (i tried both LINUX and WIN platforms,
it's the same).

my css style is applied if i visit www.example.com/ci
but, if i try anything else (ie, click a link on my navmenu), the style is not applied at all (even though is it found in the source code,
spelled exactly the same as for the working example above). so, it's not misspelled or anything like that.

furthermore, if i try this one: www.example.com/ci/front/index/ - stylesheet not applied!

what seems to be the problem? please, help, it quite urgent!

thanks
#2

[eluser]clip[/eluser]
Are you using an .htaccess file? It looks as though you possibly are.. this may be causing your problem. Furthermore, are you using relative or absolute paths to link to the stylesheet?
#3

[eluser]developer10[/eluser]
[quote author="clip" date="1259828841"]Are you using an .htaccess file? It looks as though you possibly are.. this may be causing your problem. Furthermore, are you using relative or absolute paths to link to the stylesheet?[/quote]

i renamed .htaccess file and still nothing
i'm using urls like this:

Code:
"assets/css/style.css"

on the localhost everything goes well perfectly

any other idea?

EDIT: image paths also seem correct but images are not being loaded!
#4

[eluser]therealmaloy[/eluser]
@cold_fusion

posting snippets from your actual code would be easier for people to help, htaccess, your template page or pages that could be the reason for your code problem.
#5

[eluser]developer10[/eluser]
this might be a hint:

looking at the properties of the image from the front page (which loads the style) gives: "www.example.com/ci/assets/images/imagename.jpg"
BUT, properties of the image which doesn't get loaded (from somewhere within the site is: "www.example.com/ci/class/method/parameter/if/any/assets/images/imagename.jpg"

note: in the source code the paths seems to be correct. for the style its: "assets/css/style.css" and for images "assets/images/imgname.jpg"
#6

[eluser]Phil Sturgeon[/eluser]
cold_fusion has pointed you in the right direction here. “assets/css/style.css” is a relative path from the current folder, and that means if you go down a folder, the place it is relative to cannot be found. You need to make your paths relative to the root, and for that you add a / at the front.

Or you can write <?php echo base_url(); ?>asset/css/style.css.

Both of those methods are fairly dirty and hard to adapt in the future. For a "no work required" change, try adding a <base> tag: "Asset handling in CodeIgniter with the BASE tag", or if you want a more "CodeIgniter feel" method then try my Asset library.
#7

[eluser]developer10[/eluser]
[quote author="Phil Sturgeon" date="1259848320"]cold_fusion has pointed you in the right direction here. “assets/css/style.css” is a relative path from the current folder, and that means if you go down a folder, the place it is relative to cannot be found. You need to make your paths relative to the root, and for that you add a / at the front.

Or you can write <?php echo base_url(); ?>asset/css/style.css.

Both of those methods are fairly dirty and hard to adapt in the future. For a "no work required" change, try adding a <base> tag: "Asset handling in CodeIgniter with the BASE tag", or if you want a more "CodeIgniter feel" method then try my Asset library.[/quote]

to be honest, at first i didn't understand your post completely. then i visited the link and got it. i chose <base> solution, and it works like a charm!

Thanks man!
#8

[eluser]raitucarp[/eluser]
maybe my signature is your solution, click my signature "codeigniter Theme library"




Theme © iAndrew 2016 - Forum software by © MyBB