Technical Article Let Your ENUMs Do the Talking with CSS December 14, 2009 by Lori MacVittie 3011 article applications big-ip dev hardware html icontrol management php us web 2.0 wsdl 0 When you’re dealing with conditional formatting of objects based on enumerated values you can eliminate conditional assignments by directly mapping your ENUMs to CSS classes. There are many cases where enumerated values are used to describe values, especially in the world of infrastructure 2.0. Availability status, for example, is a commonly used enumeration to indicate whether a load balancing related object – a virtual server, a pool, a node (server) – is available, unavailable, or in some unknown state. When building web-based dashboards or management interfaces for such solutions, the server-side code often ends up with a lot of conditional formatting statements as developers map enumerated status codes to HTML to make it look, well, a lot more attractive. I’m using iControl and infrastructure as an example – any application that requires formatting based on enumerated values may find this technique useful in reducing the amount of code (and time) spent on conditional formatting. By directly mapping enumerated values to CSS classes, you can eliminate the conditional formatting statements in the code which reduces the overall footprint and execution time but also has the added benefit of making it easier to hand off the styling and CSS chores to a web designer without having to worry about CSS class names and documentation around formatting. This also eliminates the need for a mapping via an associative array or other dictionary-style structures in which statuses are mapped to classes. last modified: December 14, 2009 1 Comment(s): 0 @VictorI agree completely. Sometimes we have to work with what we're given though. ;-) Lori You must be logged in to post comments.