Forum Moderators: open

Message Too Old, No Replies

         

reddevil

8:09 am on Mar 16, 2004 (gmt 0)

10+ Year Member



Sorry for asking this silly question but, up to now, I have been spoilt by using FrontPage2000 that has automated many of the tasks that I now want to do manually.

Please could anybody tell me what is the correct code to use to create ONE navigational menu that will appear on all my pages, but that will not create an underlined Link on the 'current page'?. For ease of maintenance, I want to create one menu page and then use it as a 'PageInclude' on many pages.

Currently I am using the following html

<p>
<a href="index.htm">Homepage</a><br>
<a href="../folder1/villa.htm">Villa</a><br>
<a href="../folder1/price.htm">Price</a><br>
<a href="../folder2/flights.htm">Cheap Flights</a><br>
<a href="../folder2/sports.htm">Sports</a><br>
<a href="../folder1/phone-numbers.htm">Phone Numbers</a><br>
<a href="../folder3/tips.htm">Tips</a><br>
<a href="../folder3/news.htm">News</a><br>
<a href="../folder1/weather.htm">Weather</a><br>
<a href="../folder4/links.htm">Useful Links</a><br>
<a href="../folder5/contactus.htm">Contact Us</a>
</p>

I want to use a similar code when a visitor gets to (eg) my Folder1 directory but I can't find out what html to use so that the 'current page' does not appear as a Link. What I am trying to avoid is having to insert a menu on every page because this will make future maintenance a nightmare as my site gets bigger.

Any pointers would be appreciated.

NB - I am changing because FP2000 includes <nobr> tags that make my site non-validating html 4.01 transitional.

Thanks.

DoppyNL

8:16 am on Mar 16, 2004 (gmt 0)

10+ Year Member



To prevent the link to the current page you will need some server-side scripting that will make sure that that link is simply not made. That way it won't show up as a link, simply because it isn't a link!

But I think this is not a real issue, and that you're quite safe and OK by leaving it a link.
This will also please visitors, as they still can click the link if they want to, they might get a little annoyed when they can't click something they expect to be able to click.

It will also safe you some trouble making it ;)

tedster

8:39 am on Mar 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Avoiding pages that link to themselves is definitely one of the challenges in using "included" menus - and it's the reason I prefer to code menus flat and use a global search and replace when the menu changes. However, I know that can be a bit of a hassle if your menu changes very often. A strong Information Architecture can avoid frequent menu changes - but that also may take some time to develop.

This will also please visitors, as they still can click the link if they want to, they might get a little annoyed when they can't click something they expect to be able to click.

Sorry, DoppyNL, here I disagree with you - users will get upset (and possibly confused) if they can click on a live "link" that really only reloads the current page. In fact, for many years, usability maven Jakob Nielsen has included this on his annual list of the Top Ten Web Design Mistakes [useit.com].

And Jakob's not just flappiong his gums on this point -- his "opinions" are the result of a large number of usability studies that his firm does every year.

grahamstewart

8:58 am on Mar 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A typical approach is to style the link for the current page differently. While this is not perfect (as tedster points out) it does give the users a strong visual signal.

You can use CSS to achieve this.

First modify your menu to give each link a unique id..


<p>
<a id="m_home" href="index.htm">Homepage</a><br>
<a id="m_villa" href="../folder1/villa.htm">Villa</a><br>
<a id="m_price" href="../folder1/price.htm">Price</a><br>
<a id="m_flight" href="../folder2/flights.htm">Cheap Flights</a><br>
<a id="m_sport" href="../folder2/sports.htm">Sports</a><br>
...etc..
</p>

Now give the <body> tag of each page an id that reflects it's section.
(e.g. <body id="villa">, <body id="price">, <body id="flight"> etc)

Then finally use some CSS to style the tags..


/* normal link */
a {
color: #00f;
background-color: transparent;
font-weight: bold;
}

/* current link */
#home #m_home, #villa #m_villa, #price #m_price, #flight #m_flight, #sport #m_sport {
color: #005;
background-color: transparent;
font-weight: normal;
}

Hope that helps.

ronin

11:17 am on Mar 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you're not to bothered about having code that completely validates (and tends to display the same as normal on browsers), the maintenance is absolutely minimal.

All you need to change to this code:

<p>
<a href="index.htm">Homepage</a><br>
<a href="../folder1/villa.htm">Villa</a><br>
<a href="../folder1/price.htm">Price</a><br>
<a href="../folder2/flights.htm">Cheap Flights</a><br>
...

is to delete a single 'a'.

ie. If you are on the villa page, the menu code reads:

<p>
<a href="index.htm">Homepage</a><br>
<href="../folder1/villa.htm">Villa</a><br>
<a href="../folder1/price.htm">Price</a><br>
<a href="../folder2/flights.htm">Cheap Flights</a><br>

and if you are on the price page, the menu code reads:

<p>
<a href="index.htm">Homepage</a><br>
<a href="../folder1/villa.htm">Villa</a><br>
<href="../folder1/price.htm">Price</a><br>
<a href="../folder2/flights.htm">Cheap Flights</a><br>

Quite honestly though, if you're going to take the quarter second that it takes to do this, you might as well just spend an extra two seconds and have this:

<p>
<a href="index.htm">Homepage</a><br>
<a href="../folder1/villa.htm">Villa</a><br>
Price<br>
<a href="../folder2/flights.htm">Cheap Flights</a><br>

instead. (Which will be valid...)

grahamstewart

11:30 am on Mar 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Umm.. slightly bizarre suggestion from ronin that one, probably best if you ignore it. :)

ronin: he can't just delete the link because he wants to use SSI to include the same menu on every page, which is a perfectly sensible thing to do.

reddevil

11:52 am on Mar 16, 2004 (gmt 0)

10+ Year Member



..phew, I didn't think that my problem was so complicated to resolve....I wanted to change from the FP created navbars to remove the 36 'errors' created by the <nobr> tags that are impossible to remove with FP.

All your further suggestions are welcome

txbakers

1:47 pm on Mar 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



While JaKob Neilsen might think it's bad to have a link to the same page, it's really not that big a deal.

If the page is called "Price" and there is a link to the "Price" most normal people will realize they are on the "Price" page and won't get upset.

KISS is always the first rule.

ronin

2:03 pm on Mar 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Umm.. slightly bizarre suggestion from ronin that one

It was slightly bizarre, wasn't it?! >;->

I'm just displaying my dislike for server side includes which are, in my opinion, ugly and wrong >;->

I guess I'm with Tedster, when he writes:

I prefer to code menus flat

Otherwise it's like using a sledgehammer to open a walnut.

Also, I agree with the KISS principle. I think it's a lot simpler for most internet users that there aren't any on-page links that reload the same page. Most internet users are not very good at figuring out why the same page has just loaded: they think they have made a mistake, because they "know" that links always take you to a different page.

bruhaha

2:45 pm on Mar 16, 2004 (gmt 0)

10+ Year Member



If you decide simply to change the style of the current link, don't forget the cursor!

Since in this case the link is actually still a link, on mouseover it will still change to whatever the browser uses in such cases (typically, a hand or pointer), which may be confusing.

So, you might tell it not to change, by adding to the current-link style:
cursor:default;