Can't get menu links to work with pages in sub-directories

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Linda
Beginner
Beginner
Posts: 6
Joined: Tue Jan 17, 2006 4:38 pm

Can't get menu links to work with pages in sub-directories

Post by Linda »

Can anyone help me with how I get my menu to work with the pages that are in a directory other than the one with the java script files and index page?

I have my index page in the root directory and my other pages in a Pages directory. If I put the link addresses so they work on the index page, they won't work on the other pages in the Pages directory.

Thank you!
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi Linda,

We need to see the page, please. Could you give us a link?

Ruth
Linda
Beginner
Beginner
Posts: 6
Joined: Tue Jan 17, 2006 4:38 pm

Link problems

Post by Linda »

Hi!

Here's my draft copy of the site

http://web.tampabay.rr.com/jimlinda/New ... b-content/

The links only work on the index page. Once you go to any other page, the links no longer work. I know it's something to do with the file paths but don't know what!

Thanks... :roll:
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I have to tell you I am not the person for paths, I gave up and now use full paths everyplace :?

Anyway, have you tried putting a / in front of Pages? Not sure if that will work, as I said, I'm not a path person :oops:

Ruth
Linda
Beginner
Beginner
Posts: 6
Joined: Tue Jan 17, 2006 4:38 pm

Links not working when pages are in folders other than root

Post by Linda »

Hi!
Thank you. I think I did try that one when I was going through every permutation I could think of to get it to work! I may just try to do a separate menu for the pages in the Pages folder if all else fails.

Thanks again...
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Linda,

It is, as Ruth says, a path issue (she knows more about it than she lets on!). Try this: Open the draft link that you gave us. You are now at

http://web.tampabay.rr.com/jimlinda/New ... b-content/

Now point to the "Birdie Stock" item in the main menu to open the submenu, then point at the "Birdie Stock '06" item. Stop. That item's url is set set to be relative to the current page's location on the server, because it has nothing preceding the folder name: url=Pages/birdie_stock.html; Now -- still pointing at "Birdie Stock '06" -- look at the status bar (bottom of the browser window); it shows you where it will want to go if you click that menu item. Since the current page came from

http://web.tampabay.rr.com/jimlinda/New ... b-content/

and the url=Pages/birdie_stock.html, the browser will want to go to

http://web.tampabay.rr.com/jimlinda/New ... stock.html (the %20s are spaces).

No problem. You're there.

Now open the same menu and point at the same item. Look at the status bar, and see the effect the relative path has. The currently displayed page came from

http://web.tampabay.rr.com/jimlinda/New ... stock.html

... a path/file that does not exist (you get a 404 error). See how it adds a second /Pages to the first one? That's because of the way you specify the path in the url property... you're telling the browser, "go to the 'Pages' folder located within the current folder... and there's isn't one!

How to fix?

If you put a / in front, it tells the browser to use the path relative to the root of the website. You say that didn't work. Probably because the site's root isn't

http://web.tampabay.rr.com/jimlinda/New ... eb-content

(just a guess). What is the root location of your site? Do you know? Knowing that would help devise a strategy. Also, are the folders and pages as they exist now the way you intend to keep it, or is it just for development purposes? Do you intend to move everything once it's done? That can affect the best strategy. Try to answer these, and we will help you come up with a better plan than having to maintain a set of menu_data files for every level of your site.

Here's a little test that might help.

Make a menu item like this

Code: Select all

aI("text=test; url=/;");
Open the page and point at that "test" menu item. What location do you see in the browser's status bar? That's your wenbsite's root location. Can you tell us what it is?

Cheers,

Kevin
Linda
Beginner
Beginner
Posts: 6
Joined: Tue Jan 17, 2006 4:38 pm

Links not working when pages are in folders other than root

Post by Linda »

Hi Kevin!
I'm pretty sure my root folder is New Feathered Friends/web-content (I'm working in Go Live CS2 and that's how it sets up a site). I have my index.html and all the Milonic .js files there.

The site has lots of pages so I created another folder called "Pages".My problem is if I set the paths to work on the index page, they don't work on the other files in the Pages directory. I rechecked to see if it would work by putting a "/" in front of the Pages/mypage.html and no luck.

I do intend to keep the same set up when I put the site up (unless I absolutely have to dump all the pages in the root directory to get the menu to work!)

I tried the "test" link on my computer and nothing happened! No error message, nothing! I will put it up on my test site tomorrow to see what happens there. My dogs are barking up a storm...it's time for their peanut butter bones so I've got to go.

Thank you for all your help.
Linda :lol:
Linda
Beginner
Beginner
Posts: 6
Joined: Tue Jan 17, 2006 4:38 pm

Links not working when pages are in folders other than root

Post by Linda »

Hi again and good morning!

I uploaded the new menu_data.js file with a "test" link under "Birdie Stock '06". I'm not getting any info on the link in the status bar...I don't think it's working (I'm using Safari).

More later!

Linda
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi Linda,

In your test item, try url=/index.html

Does that take you to your home page?

Kevin
Linda
Beginner
Beginner
Posts: 6
Joined: Tue Jan 17, 2006 4:38 pm

links not working when pages are in folders other than root

Post by Linda »

Hi!
I changed the url in the test link to index.html but it's still not working.

I think I am going to just put all the pages in the root directory, with the index page.

Thank you for helping! :lol:
Post Reply