Solved

How to make list items like php.net where the list item highlights for current function.

Posted on 2015-02-20
3
71 Views
Last Modified: 2015-02-20
I have a long category list. I don't want to have an if statement for each list item to echo out one of two css properties, (highlight or no-highlight). PHP.net has an example of a vertical list on the right side of the page that highlights the current page in red. Is there an efficient way to code this functionality? Thanks.

http://us3.php.net/manual/en/function.time.php
0
Comment
Question by:kadin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 40622511
Yes.  It's usually done via a templating system.  The CSS classes are set in the PHP script that generates the web page.  The web page uses HEREDOC notation to inject the CSS class into the generated HTML in order to highlight the appropriate data elements.  This requires some forethought and planning, but the basic idea is an array of links, a matching array of CSS classes, and a bit of logic to set the class on the active link.
0
 

Author Closing Comment

by:kadin
ID: 40622521
Thanks again Ray. I think I get the idea.
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40622524
Thanks for the points.  If you need an example, I can probably come up with one tomorrow.  But a "view source" of the PHP web page will give a lot of good hints.

Best regards, ~Ray
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question