Home > CMS Tutorial > DEDECMS > body text

How to change the color of dede dreamweaver article list every other row

藏色散人
Release: 2019-12-28 09:10:10
Original
2137 people have browsed it

How to change the color of dede dreamweaver article list every other row

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=&#39;adminbuy.cn_c&#39;>"; 
$adminbuy.cn_b="<li class=&#39;&#39;adminbuy.cn_d&#39;>";
if ((@me%2)==0) @me=$&#39;adminbuy.cn_a; 
else @me=$&#39;adminbuy.cn_b;
[/field:global]
<a href=&#39;[field:arcurl/]&#39;>[field:title/]</a>
</li>
{/dede:arclist}
Copy after login

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=&#39;12&#39; titlelen=&#39;33&#39; typeid=&#39;1&#39; orderby =&#39;pubdate&#39;}
<li class=&#39;&#39;adminbuy.cn_c&#39;><a href=&#39;[field:arcurl/]&#39;>[field:title/]</a></li>
{/dede:arclist}
Copy after login

When it is not divisible by 2, it is false and outputs $'adminbuy.cn_b. At this time, The code is:

{dede:arclist row=&#39;12&#39; titlelen=&#39;33&#39; typeid=&#39;1&#39; orderby =&#39;pubdate&#39;}
<li class=&#39;&#39;adminbuy.cn_d&#39;><a href=&#39;[field:arcurl/]&#39;>[field:title/]</a></li>
{/dede:arclist}
Copy after login

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=&#39;12&#39; titlelen=&#39;33&#39; typeid=&#39;1&#39; orderby =&#39;pubdate&#39;}
<li><a href=&#39;[field:arcurl/]&#39;>[field:title/]</a></li>
[field:global runphp=&#39;yes&#39; name=autoindex]
if(@me%2==0)@me="<hr />";
else @me="";
[/field:global]
{/dede:arclist}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!