Traditionally when you have lost lists of dat you want to alternate rows for usability. The first thing everybody makes to fix this is a simple if statement loop, but this adds a number of lines and is hardly a clean solution. Additionally it required you to have a “counter” or “switch” variable, usually placed at the bottom of the loop, overall very messy.
I had a boss who thought he was on the cutting edge by compressing the traditional if statement into a shorthand version (saving 2-3 lines of code), but the system was still using a $class variable and still requires a counting or switch variable. It was still a mess and added clutter to the code.
Earlier today I was working on outputting client records forafully customized application. Wanting to avoid such messy code as I looked for a better solution and with a little tweaking and playing I came up with this.
I've also included a simple example of how it's used in action. If you have any questions or concerns let me know either here or at the link (there's some more info about this method there too if your intreated).
You need to login to post a comment.