Keeping Navigation Current With PHP: A List Apart

A List Apart's Front PageIt gives me great pleasure to report that A List Apart accepted and published an article of mine. For the next week, my article appears on the front page of their site.

A List Apart Magazine (ISSN: 1534-0295) explores the design, development, and meaning of web content, with a special focus on techniques and benefits of designing with web standards. I’ve learned so much from them over the years and wanted to give a little back.

So I submitted an article on how to use PHP and CSS to keep track of your current page in navigational menus. Here it is:

Keeping Navigation Current With PHP: A List Apart
by Jason Pearce

Turning unordered lists into elegant navigational menus has become the new favorite pastime for many web developers. Adding a unique id or class attribute to indicate which menu item reflects a user’s current page, however, can become laborious. Even if you use body id attributes instead, as ALA does, some labor is involved and it is easy to make mistakes. But thanks to PHP, we can add these current-page indicators automatically.” …more

Thanks ALA for the years of ideas, tutorials, and articles.

3 replies on “Keeping Navigation Current With PHP: A List Apart”

  1. Jason

    I came across your excellent article on ALA however I am struggling to get this to work and I was hoping you could help a relative newbie?!

    I have created a website using Christopher Robbins’ tutorial called ‘Manage Your Content With PHP’. This uses a PHP template file that includes different html files for content. What I would like is that the navigation menu highlights which page is currently active, however, how does your system work when the included individual pages that contain the variable $thisPage=”xxxx” are html? Surely they need to be PHP files??

    Any help would be much appreciated.

    Thanks in advance

  2. Hi Jason, I was working with your tutorial trying to get things to work and I’m having trouble. I followed the directions but when the php spits out the information for the html it’s not showing anything. I’m using includes for the navigation. I don’t want it to pick up an ‘id’ so I changed that to ‘class’ since I’m using an ‘id’ for a background image so I don’t know if it’s that… But is there somewhere where you have your demonstration in a zip file that viewers can download and play with? Thanks in advance.

  3. I strongly recommend that you turn the No Follow off in your comment section.

    I’ll watch Google Webmaster Tools, and if the links don’t show up after a couple of weeks — I won’t go back to that blog again.

    Another suggestion: you should have a Top Commentator widget installed.

    Do Follow and Top Commentator will ensure that you have a successful blog with lots of readers!

Comments are closed.