Home > CMS Tutorial > DEDECMS > body text

How does Dede change the background color of the article list on alternate lines?

藏色散人
Release: 2019-12-23 10:24:48
Original
2121 people have browsed it

How does Dede change the background color of the article list on alternate lines?

How does Dede change the background color of the article list on alternate lines?

Changing colors between rows in the article list can make the two displayed contents different. Many websites use the display method of changing colors between rows in the list page. Let’s share with you how Dede implements it.

Recommended study: 梦Weavercms

dede can also implement the method of changing the background color of the list with alternate rows like the forum. Let’s take a look below. Interlaced color change in the article list can make the two displayed contents different. Many websites use the interlaced color display method in the list page. Below I will post the implementation of interlaced color change in cms so that friends who need it can Refer to the following for modifications.

Add a line every 5 lines in the list:

The code is as follows:

{:list pagesize='50'} 
<LI><a href="[field:arcurl /]" title="[field:title function=&#39;htmlspecialchars(@me)&#39;/]" 
target=_blank>[field:title function="cn_substr(@me,48)"/]</a>[field:pubdate runphp=&#39;yes&#39;] 
$a="<font color=red>".strftime(&#39;%m-%d&#39;,@me)."</font>"; 
$b=strftime(&#39;%m-%d&#39;,@me); 
$ntime = time(); 
$day3 = 3600 * 24; 
if(($ntime - @me) < $day3) @me = $a; 
else @me =$b; 
[/field:pubdate]
[field:global name=autoindex runphp="yes"] 
if(@me%5==0)@me="<hr />"; 
else @me=""; 
[/field:global] 
{/dede:list} 
<DIV></DIV></LI> 仿
Copy after login

The above is the detailed content of How does Dede change the background color of the article list on alternate lines?. 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