Jump to content

Recommended Posts

Posted

Let's say that a website has a horizontal navigation bar at the top and that the CSS file styles the navigation bar so that the current page's link has a different colored background than the rest of the navigation bar. Now let's say that none of the CSS works (which is what I often end up pretending when I am trying to code for accessibility). How could I use XHTML to indicate on the navigation bar that the user is on a specific page? I know that not linking that list element is a good clue to the user and I also know that I could use alt text to note that it is the current page. Is there anything else that I could do?

 

Thank you in advance for your input!

Posted

If you use actual &--#60;button&--#62;s or &--#60;input type="image"&--#62;s you can have PHP, Perl, or what-have-you take note of the current page requested and change the button image corresponding to it to a solid color different then the rest. As for the usual &--#60;a&--#62; navbar I think you covered the possibilities, though the biggest clue would be to just leave out the current page in the navbar, which a server-side script could help you do as well, or you could make a different navbar for each page omitting the current page in the list.

Posted

I am not too familiar with anything besides (X)HTML and CSS. Are there certain browsers that do not like PHP or Perl and are they fairly easy to learn?

Posted

PHP and Perl are server-side languages, they work in any browser. The code I use for my site gets the current page URI, then adds the class .current to the link of the current page. You could then use CSS to style .current however you plan to set it apart.

<ul>
<li><a href="/" <?php if ($_SERVER['REQUEST_URI'] == "/" || $_SERVER['REQUEST_URI'] == "/index.php") echo "class='current'"; ?>>Home</a>
<li><a href="/link" <?php if ($_SERVER['REQUEST_URI'] == "/link") echo "class='current'"; ?>>Link</a>
<li><a href="/link" <?php if ($_SERVER['REQUEST_URI'] == "/link") echo "class='current'"; ?>>Link</a>
<li><a href="/link" <?php if ($_SERVER['REQUEST_URI'] == "/link") echo "class='current'"; ?>>Link</a>
<li><a href="/link" <?php if ($_SERVER['REQUEST_URI'] == "/link") echo "class='current'"; ?>>Link</a>
</ul>

There are certainly more efficient ways to do this, most likely in other languages than PHP. This is just a quick example that works. Replace /link with your URI.

Posted

They're easy to pick up and browsers don't deal with them at all, PHP and Perl are server-side languages, the processing happens on the server and you use variables and objects to create dynamic HTML that varies based on what you want users to see when certain conditions are met.

 

EDIT: Ice ninja'd me :(

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...