?
Solved

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

Posted on 2015-02-20
3
Medium Priority
?
74 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
  • 2
3 Comments
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 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 111

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month16 days, 2 hours left to enroll

850 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