This article describes the simplest method in Smarty to implement parity and even color change in a list. Share it with everyone for your reference. The details are as follows:
I recently encountered a problem in the process of changing templates: changing the color of every other row on the list page. I originally wanted to use a program to achieve it, but I found a very convenient method in the smarty template on the Internet. I would like to share it:
{section name=cat loop=$list} <tr bgcolor="{cycle values="#FFFFFF,#CCCCCC"}"> <td>{$list[cat].id}</td> </tr> {/section}
I hope this article will be helpful to everyone’s smarty template program design.