Forum Moderators: open

Message Too Old, No Replies

With a primary navigation bar included by SSI: how to disable link...

...for current page visitor is viewing?

         

zollerwagner

5:18 am on Feb 14, 2005 (gmt 0)

10+ Year Member



For navigation bars, usability experts usually suggest that you not make the link to the current page clickable. That makes sense.

How can you implement this when the navigation bar is included with a server-side include, so it's the same for the entire site?

The simplest method I can think of would be to have different includes for the index page of each category in the primary navigation. You'd only need a handful of extra ssi files.

Is there an easier way to do this with CSS and HTML?

le_gber

9:52 am on Feb 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



what technology do you use for the ssi?

if php you can do:

before the opening <html> tag of each pages:

<?php $mypage="home"?> if on homepage
or
<?php $mypage="about"?> if on about page

....

in your ssi:

<?php if ($mypage =="home"){?>

home

<? } else {?>

<a href="index.php" > home </a>

<? } if ($mypage=="about"){?>

about

<? } else {?>

<a href="about.php" > about</a>

<? }?>

Leo

zollerwagner

3:14 pm on Feb 14, 2005 (gmt 0)

10+ Year Member



That's an interesting idea. Thanks!

I have just used HTML and CSS, but the PHP solution would allow me to do it all with one include file.

Are there other places in the site that you use PHP to customize little things like this?

le_gber

5:15 pm on Feb 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yes, everytime I have to do something more than once :-) - navigation (your example), footer, list of items (in a client's protfolio or member list) etc... you can even take it out further and have one include for each side displaying the content of the proper page i.e.:

one include with some news that you want to display on homepage, the same include with your products or services to be displayed on the product page and services page and one include with the alternate email that you could show on the about page as well as the contact page.

the possibilites are endless ;-)

leo

zollerwagner

6:13 pm on Feb 14, 2005 (gmt 0)

10+ Year Member



Hey, Leo,

I was thinking more about how to use PHP to customize pages. I've got includes for repeated sections of pages.

I've used PHP to run my contact pages, special online forms (like job applications), a forum, announcements (which the site owner can update easily), and photo albums.

After reading your first post, it struck me that there might be even simpler uses that I'm missing, things like the way you suggested turning off the navigation bar's link for the current page.

Are there other places that you typically use PHP to serve up custom pages?

le_gber

8:17 pm on Feb 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sorry not sure what you mean.

what I meant in my previous post was that I have one include for the whole site and in this include I have all the possible info to be displayed on all the pages of the site.

let's say:

include left:

<? if (isset($page)) {?>
show navigation

<? } if ($page =="news" ¦¦ page =="home") {?>
show news

<? } if ($page!="contact") {?>
show contact details

...

hope this is what you're after.

leo

zollerwagner

11:58 pm on Feb 14, 2005 (gmt 0)

10+ Year Member



Oh, I see what you're saying. So even for the columns, you use PHP to determine which items will be displayed.

Before I didn't catch that PHP was used there, too.

Thanks, I appreciate the second idea, too!