[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
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
?
73 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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.
Suggested Courses

656 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