News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Felix Geisendorfer's Blog:
MacGyver menu for CakePHP - What's the active menu item?
July 09, 2007 @ 09:34:00

In a new post to his blog today, Felix Geisendorfer talks about view coding - specifically working with a menu and determining which element is active.

One of the challenges many of us have faced before and will face in future is building a menu. Now this of course is very simple assuming that we're just shooting for a static <ul> with some <li>'s containing the links. However the tricky part is to figure out what is the active menu item. I had some code doing this in the past but tried out a new flavor of it today which I call the MacGyver menu for CakePHP as it's a little dirty yet powerful and easy to maintain.

In his included code, he creates a simple navigation from an array of titles/links and, with some sorting, a regular expression and a CSS class, the selected item can be highlighted simply.

0 comments voice your opinion now!
cakephp framework navigation highlight active menu cakephp framework navigation highlight active menu


blog comments powered by Disqus

Similar Posts

Fabien Potencier: SensioLabs raises 5 million euros to boost the Symfony ecosystem

Andi Gutmans\' Blog: New Zend Framework Website look launched (almost)

Paul Jones' Blog: Aura for PHP 5.3+, aka Solar 2.0

NETTUTS.com: Creating a File Hosting Site with CodeIgniter

7PHP.com: Interview With PPI - The PHP Meta-Framework


Community Events





Don't see your event here?
Let us know!


interview wordpress language community series library project threedevsandamaybe configure introduction api release framework list application podcast developer code bugfix laravel

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework