dedeHow to change the color of the dreamweaver article list?
Let me share with you a piece of code that can make the dreamweaver article list The background of the article list achieves the interlaced color changing effect: the specific code is as follows, you can modify it according to your own needs:
Recommended learning: 梦Weavercms
The sample code is as follows:
{dede:arclist row='12' titlelen='33' typeid='1' orderby ='pubdate'} [field:global runphp='yes' name=autoindex] $adminbuy.cn_a="<li class='adminbuy.cn_c'>"; $adminbuy.cn_b="<li class=''adminbuy.cn_d'>"; if ((@me%2)==0) @me=$'adminbuy.cn_a; else @me=$'adminbuy.cn_b; [/field:global] <a href='[field:arcurl/]'>[field:title/]</a> </li> {/dede:arclist}
It can be seen from the above example:
This code uses autoindex auto-increment, and the auto-increment number is modulo 2. When the auto-increment number %2==0, that is to say When the self-increasing number is divisible by 2, it is true and outputs $'adminbuy.cn_a. The code at this time is:
{dede:arclist row='12' titlelen='33' typeid='1' orderby ='pubdate'} <li class=''adminbuy.cn_c'><a href='[field:arcurl/]'>[field:title/]</a></li> {/dede:arclist}
When it is not divisible by 2, it is false and outputs $'adminbuy.cn_b. At this time, The code is:
{dede:arclist row='12' titlelen='33' typeid='1' orderby ='pubdate'} <li class=''adminbuy.cn_d'><a href='[field:arcurl/]'>[field:title/]</a></li> {/dede:arclist}
By outputting different class styles in the li tag (two styles, 2l3.net_c and 2l3.net.com_d, need to be defined in the css), the interlaced color can be changed.
Through the analysis of this code, we can also expand our ideas. Is it possible to add an underline every two lines?
{dede:arclist row='12' titlelen='33' typeid='1' orderby ='pubdate'} <li><a href='[field:arcurl/]'>[field:title/]</a></li> [field:global runphp='yes' name=autoindex] if(@me%2==0)@me="<hr />"; else @me=""; [/field:global] {/dede:arclist}
After testing, the above can indeed add an underline every 2 lines.
The above is the detailed content of How to change the color of dede dreamweaver article list every other row. For more information, please follow other related articles on the PHP Chinese website!