User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 402,026 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,401 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1511 | Replies: 7 | Solved
Reply
Join Date: Mar 2007
Location: RI
Posts: 146
Reputation: Dsiembab is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Dsiembab's Avatar
Dsiembab Dsiembab is offline Offline
Junior Poster

Help hierarchy of a website

  #1  
May 10th, 2007
Well my question is, I have a website run with apache and I was wondering, if I have many webpages and wanted to put them in diffferent directories ( for ease of use) with a index.html how would I be able to call the css in another directory to the index of a different directory? I mean lets say I have a directory ( we'll call this directory 1) which contains my css directory and I different webpage directories.here is an example:
parent directory
css directory
blah directory with index html
blah directory with index html
blah directory with index html
Thanks Dave
Last edited by Dsiembab : May 10th, 2007 at 6:55 am.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2005
Location: Nebraska, U.S.
Posts: 187
Reputation: stupidenator is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
stupidenator's Avatar
stupidenator stupidenator is offline Offline
Junior Poster

Solution Re: hierarchy of a website

  #2  
May 10th, 2007
You can call the css like this:

<link rel="stylesheet" href="../css_directory/style.css" />

Each time you put " ../ " in there, it goes up to that folders parent directory. Once you get to the directory that is parent to the one your css is in, then you can go from there into the css. Hope this helps.

Nick
Reply With Quote  
Join Date: Mar 2007
Location: RI
Posts: 146
Reputation: Dsiembab is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Dsiembab's Avatar
Dsiembab Dsiembab is offline Offline
Junior Poster

Re: hierarchy of a website

  #3  
May 10th, 2007
thanks appreciate it
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 47
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: hierarchy of a website

  #4  
May 10th, 2007
if your CSS files are ALWAYS in the folder that maps to http://yourdomain.tld/css_directory/, you can use an absolute link as follows:
<link rel="stylesheet" href="/css_directory/style.css" />
This is useful if your linking files are in folders nested to levels deeper than 1 from the document root.. note, it can make 'moving things around' easier or more difficult, depending on what you're trying to do..

absolute links can certainly make it more difficult to preview pages that you're working on offline, unless you go REALLY absolute:
<link rel="stylesheet" href="http://yourdomain.tld/css_directory/style.css" />
or run Apache offline, or always work at root or in some kind of dynamically rooted environment, or use a site-aware url rewriting preview tool; like that in Dreamweaver...
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
Join Date: Mar 2007
Location: RI
Posts: 146
Reputation: Dsiembab is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Dsiembab's Avatar
Dsiembab Dsiembab is offline Offline
Junior Poster

Re: hierarchy of a website

  #5  
May 11th, 2007
Thanks matt appreciate it I eventually used the "../" for my pages to import their css less typing and it was no hassle. If my page and csss are seperated by 3 parent groups I just use"../../../css_directoy/css.css
Reply With Quote  
Join Date: Jan 2007
Posts: 2,537
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 109
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: hierarchy of a website

  #6  
May 12th, 2007
Of course, that becomes a headache if your URL changes for some reason, You have to edit every file and change it (just like I had to when my new ISP used "index.htm" instead of "home.htm" for the opening page - a lot of work when you have 300 pages).

I had to change my url 3 times.

1. My old ISP integrated several urls into a master url. They told us we would never have to change it again.

2. The master url created in change #1 contained the computer name "php" (for "personal home pages"). PHP later trademarked that name, and so my old ISP had to change the url again. I converted all of my code to relative addressing at this time.

3. I changed to a new ISP with a cheaper rate. But since they used the different entry page name, I had to change the homepage link in every page.
Last edited by MidiMagic : May 12th, 2007 at 12:51 pm.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Mar 2007
Location: RI
Posts: 146
Reputation: Dsiembab is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Dsiembab's Avatar
Dsiembab Dsiembab is offline Offline
Junior Poster

Re: hierarchy of a website

  #7  
May 12th, 2007
Should I switch my html to asp so I wouldn't have that problem?
Reply With Quote  
Join Date: Mar 2007
Location: RI
Posts: 146
Reputation: Dsiembab is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 2
Dsiembab's Avatar
Dsiembab Dsiembab is offline Offline
Junior Poster

Re: hierarchy of a website

  #8  
May 24th, 2007
Originally Posted by MidiMagic View Post
Of course, that becomes a headache if your URL changes for some reason, You have to edit every file and change it (just like I had to when my new ISP used "index.htm" instead of "home.htm" for the opening page - a lot of work when you have 300 pages).


I found a program on the net that might help if that ever happens again. It's called Simple Search/replace. you can find it if you google the name. I've been using ti and it seems like a great time saver. It's by RJL software online. Try it out if you'd like
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 10:14 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC