This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Problem with css file paths Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with css file paths" Watch "Problem with css file paths" New topic
Author

Problem with css file paths

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Ok i have a domain directory called TEF. now the actual path is like root/blah/moreblah/folder/folder2/TEF.
but if you type www.theepicfew.com it will just automatically go to TEF.

Now here is the problem. I have a bunch of external style sheets in /TEF/Stylesheets. But for some reason when I link my css in index.php like so:

<link rel="stylesheet" type="text/css" href="Stylesheets/Navigation.CSS" />

for some reason, the style changes are not getting applied to the page.

if you go to http://www.newfazeindustries.com/guild/guildarmory/guildarmory
and then http://www.theepicfew.com, you'll see the difference.

I tried doing "/Stylesheets/Navigation.CSS", but no luck.

But I have the folder structure the exact same as it is on newfazeindustries, but it doesnt work on theepicfew for some reason....

This might be a really dumb question, but I'm not all that familiar with this stuff.

Thanks,

Justin


You down with OOP? Yeah you know me!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Add the app context path to the CSS file path.
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
I'm sorry if I come off as annoying, but what is the app context path?

Thanks again,

Justin
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Not annoying at all.

It's what's necessary to create a full pathname for web-app-relative files. You can use JSTL's <c:url> tag, a scriptlet <%= request.getServletContext...%> (or something like that, I actually don't remember). Searching the web for something like "jsp +get context path" will turn up a lot of hits.
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Oh ok, I'll see if there is a way to do it in php.. that's the server sided code I'm using and don't know if the server supports JSP.

Thank man!

Justin
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Oh. That's a completely different question, since PHP doesn't have an equivalent to contexts. You shouldn't need to do anything at all.
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
well it's weird, because my script files are working just fine, only my .CSS files are not being recognized (so i think), but I have all the functionality of my site in external .js files and they work just fine.

but even when I try to do a link like so:

admin

where admin.php is in the same directory, gives me a broken link error.

I'm not sure what's going on then....

Justin
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

When I navigate to http://www.theepicfew.com/Stylesheets I get a 404 whereas when I navigate to http://www.theepicfew.com/Scripts I get a Forbidden error, which makes sense. But the 404 would imply that path doesn't exist at all. Are you sure it is there?


GenRocket - Experts at Building Test Data
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
lmao wow, it was case sensitive..... on my server it wasn't, but on the godaddy one it was >: (.

it was "StyleSheets" not "Stylesheets".

Sorry for the fuss over nothing.

Thanks for all the help though.

Justin
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Justin Fox wrote:lmao wow, it was case sensitive..... on my server it wasn't, but on the godaddy one it was >: (.

it was "StyleSheets" not "Stylesheets".

Sorry for the fuss over nothing.

Thanks for all the help though.

Justin


Windows is not case sensitive, linux is.
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Ah, I thought I had a linux server on 1and1, maybe not.

I'll never forget now : ).

Justin
 
GeeCON Prague 2014
 
subject: Problem with css file paths