Click to See Complete Forum and Search --> : Linking with CSS dropdowns...


hooloovoo24
02-14-2005, 12:28 PM
Hi, I'm trying to create a CSS based dropdown menu (suckerfish menu), and have kind of hit a road block when it comes to linking. Because I have my site set up with folders, I can't see how I will be able to use the same html for each page and still have the links work correctly. Because I want to put the menu in a template which I will use on all the pages, but since the pages are all in different folders, the links will screw up.
Example!

index.html is not in a folder
Folder1 contains file1.html and file1a.html
Folder2 contains file2.html and file2a.html
etc.

When I want to link to file1.html, I could put in <a href="file1.html">. This will work fine if I am on page file1a.html or anywhere within Folder1. But if I am on page file2.html or anywhere NOT in folder1, I would have to put something like <a href="../folder1/file1.html"> and then that won't work if you are not in a folder, for example on the index page.

I had this problem back when I was using javascript for the menu, but solved it by creating a variable called baseHref which made all links absolute...but obviously I can't do the same thing here. So would I actually have to have go through and type out the entire absolute links for every one in order for it to work?

Pittimann
02-14-2005, 12:38 PM
Hi!

You could use absolute paths (the 'full business': href="http://www.mysite.com/myfolder/myfile.html").

Cheers - Pit

Edit: Ooops - I read your post again (until the end) and I have to admit: my post is garbage. Sorry for that.

hooloovoo24
02-14-2005, 12:40 PM
*sigh* I was afraid someone would say that. I don't like doing that for reasons not even I know...but I guess you gotta do what you gotta do, so, thanks!

Triumph
02-14-2005, 12:42 PM
Originally posted by hooloovoo24
*sigh* I was afraid someone would say that. I don't like doing that for reasons not even I know...but I guess you gotta do what you gotta do, so, thanks! Eh?:confused:

Pittimann
02-14-2005, 12:52 PM
Hi!

You could at least avoid having to type the domain stuff by using:
href="/myfolder/mynestedfolder/myfile.html"

Better than nothing. :D

Cheers - Pit

hooloovoo24
02-14-2005, 12:54 PM
Originally posted by Triumph
Eh?:confused:

Nevermind. I'm tired.

David Harrison
02-14-2005, 02:36 PM
Do you have any server-side languages available? You could do something similar to what you did with the JavaScript menu. If you have a server-side language available then I'll elaborate a bit further, if you use ASP I could even write the function for you, if you use PHP then get out of my sight. :p

mikepurvis
02-14-2005, 05:12 PM
Originally posted by Pittimann
href="/myfolder/mynestedfolder/myfile.html"

This is what I do. Once you get into mod_rewrite territory (which there's no excuse to not do, if you're on apache), you pretty well have to.

breunor
02-15-2005, 08:23 AM
I use SSI include to put my navigation menu on every page, thus I have just the one text file to edit and I'm done. I also use relative links, which requires a BASE reference in each page using the menu: <BASE href="http://www.webpage.net"> Then all your relative links start from that point, regardless of where your web page is. You can even move them to a new web site if you want! The BASE declaration needs to go into the header. This is a very simple solution, nothing fancy is needed.

David Harrison
02-15-2005, 09:06 AM
<base> is now depreciated though. To be honest I don't see what the problem is with just using /directory/file.html it'll work on every page.

hooloovoo24
02-15-2005, 11:34 AM
Originally posted by lavalamp
Do you have any server-side languages available? You could do something similar to what you did with the JavaScript menu. If you have a server-side language available then I'll elaborate a bit further, if you use ASP I could even write the function for you, if you use PHP then get out of my sight. :p

Umm...I think I have ASP but I'm not sure. How would I find this out?

David Harrison
02-15-2005, 02:09 PM
Well, your host should just tell you. But if not, give this a whirl, save as a .asp file and upload it:<%@ language="VBscript" %>
<% option explicit %>
<%= "Hi" %>If you only see Hi when you run the page it works, if you see the whole she-bang, then it doesn't.

hooloovoo24
03-03-2005, 12:41 PM
OK...sorry this has been so long, and i'm dredging this thread up from godknowswhere, but it is what it is. I've been so busy with other crap that I haven't had time to deal with this yet. But now I can. So...I DO have ASP but I have no clue how to use it...so if anyone wants to help me...:cool:

hooloovoo24
03-17-2005, 12:26 PM
Originally posted by David Harrison
<base> is now depreciated though. To be honest I don't see what the problem is with just using /directory/file.html it'll work on every page.

Well, if I do that, I won't be able to test it until it is online, right? because I'd have to put in... http://www.site.com/whatever or something, wouldn't I? Or am I getting this wrong?

PS sorry for again dredging this up, but I'm desperate for a solution here, so please someone help me before I annoy us all to death!