Jump to content

define relative paths


wolfkin

Recommended Posts

I remember among the many tutorials a method for defining the starting path of relative links.

 

Ok I found what I'm looking for the BASE attribue

 

out of curiosity is it a good idea to use it or not? I was reading some of the CSS tutorials that suggested it would be better to use ID instead of CLASS all the time. Is it the same sort of situation with BASE?

Edited by wolfkin
Link to comment
Share on other sites

ID's should only be used once on a page, but Classes can be used several times.

ID's are 'more specific' that 'class', so I would suggest that you use ID's for the page structure and class for elements within the structure.

 

Base I have no experience with other that a CMS I run uses it, but it is automated, so I have not really cheked it out.

Link to comment
Share on other sites

Base has never been wide spread, sop not sure what support it has.

 

Relative is basically saying "You are here and need to go there... so leave this folder where you are now (../) and enter this folder and find the file there." This way of doing things is OK for static sites.

 

But what of dynamic sites? What if you want to use a PHP include so you only have one file with your navigation for your 1,000 pages? Well the Include is in a "includes" folder. Your pages are in a "PHP" folder or may folders for different catagories... and your index is in the Root folder. The paths are different so relative will not work. So you either write links as http://www.... or you put the full URL in a variable that you use. Either way as it works from the uppermost layer being the root, it does not matter what level any one linked file is in... the browser goes there from the root folder and finds it every time.

 

I do it that way with my sites. I really can't say how well Base works, but it is the same idea. I have never really seen any sites using it.

Link to comment
Share on other sites

He beat me again.

 

Yes you should use ID's more than classes. ID's can also be used for programming so you have more uses for them like anchors etc. I build whole sites never using classes, generally I use them sparingly. You should not repeating things that often and you can define any element in an ID. You do not need classes for links because you can wrap the lint in a List with an ID and say that all hyperlinks in that list should be so. All paragraphs in this DIV ID should use this font etc. There is little to know reason to use a class if you can define the element within and ID.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...