search
HomeCMS TutorialDEDECMSHow to change the color of dede dreamweaver article list every other row

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}

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}

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}

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}

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.