944,005 Members | Top Members by Rank

Ad:
May 10th, 2007
0

hierarchy of a website

Expand Post »
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:
HTML and CSS Syntax (Toggle Plain Text)
  1. 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 7:55 am.
Similar Threads
Reputation Points: 18
Solved Threads: 2
Junior Poster
Dsiembab is offline Offline
156 posts
since Mar 2007
May 10th, 2007
0

Re: hierarchy of a website

You can call the css like this:

HTML and CSS Syntax (Toggle Plain Text)
  1. <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
Reputation Points: 18
Solved Threads: 4
Junior Poster
stupidenator is offline Offline
192 posts
since Mar 2005
May 10th, 2007
0

Re: hierarchy of a website

thanks appreciate it
Reputation Points: 18
Solved Threads: 2
Junior Poster
Dsiembab is offline Offline
156 posts
since Mar 2007
May 10th, 2007
0

Re: hierarchy of a website

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:
HTML and CSS Syntax (Toggle Plain Text)
  1. <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:
HTML and CSS Syntax (Toggle Plain Text)
  1. <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...
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
May 11th, 2007
0

Re: hierarchy of a website

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
Reputation Points: 18
Solved Threads: 2
Junior Poster
Dsiembab is offline Offline
156 posts
since Mar 2007
May 12th, 2007
0

Re: hierarchy of a website

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 1:51 pm.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
May 12th, 2007
0

Re: hierarchy of a website

Should I switch my html to asp so I wouldn't have that problem?
Reputation Points: 18
Solved Threads: 2
Junior Poster
Dsiembab is offline Offline
156 posts
since Mar 2007
May 24th, 2007
0

Re: hierarchy of a website

Click to Expand / Collapse  Quote originally posted by MidiMagic ...
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
Reputation Points: 18
Solved Threads: 2
Junior Poster
Dsiembab is offline Offline
156 posts
since Mar 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Connecting a forum with an HTML site. Help plz
Next Thread in HTML and CSS Forum Timeline: CSS not displaying properly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC