Easiest way to alternate row colors in PHP/HTML?

前端 未结 19 1919
無奈伤痛
無奈伤痛 2020-12-01 03:41

Here\'s a PHP example of mine. Can anyone find a shorter/easier way to do this?


    
19条回答
  •  一整个雨季
    2020-12-01 04:25

    Smarty has it inbuilt:

    {section name=rows loop=$data}
    
       {$data[rows]}
    
    {/section}
    

    So does Django:

    {% for o in some_list %}
        
            ...
        
    {% endfor %}
    

提交回复
热议问题