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=http://www.webdeveloper.com/forum/archive/index.php/"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?Hi!
You could use absolute paths (the 'full business': href=http://www.webdeveloper.com/forum/archive/index.php/"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.*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!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?Hi!
You could at least avoid having to type the domain stuff by using:
href=http://www.webdeveloper.com/forum/archive/index.php/"/myfolder/mynestedfolder/myfile.html"
Better than nothing.
Cheers - PitOriginally posted by Triumph
Eh?
Nevermind. I'm tired.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. Originally posted by Pittimann
href=http://www.webdeveloper.com/forum/archive/index.php/"/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.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.webdeveloper.com/forum/archive/index.php/"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.<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.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.
Umm...I think I have ASP but I'm not sure. How would I find this out?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.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...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... <!-- m --><a class="postlink" href="http://www.site.com/whatever">http://www.site.com/whatever</a><!-- m --> 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!
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=http://www.webdeveloper.com/forum/archive/index.php/"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?Hi!
You could use absolute paths (the 'full business': href=http://www.webdeveloper.com/forum/archive/index.php/"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.*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!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?Hi!
You could at least avoid having to type the domain stuff by using:
href=http://www.webdeveloper.com/forum/archive/index.php/"/myfolder/mynestedfolder/myfile.html"
Better than nothing.
Cheers - PitOriginally posted by Triumph
Eh?
Nevermind. I'm tired.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. Originally posted by Pittimann
href=http://www.webdeveloper.com/forum/archive/index.php/"/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.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.webdeveloper.com/forum/archive/index.php/"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.<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.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.
Umm...I think I have ASP but I'm not sure. How would I find this out?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.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...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... <!-- m --><a class="postlink" href="http://www.site.com/whatever">http://www.site.com/whatever</a><!-- m --> 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!