SoFunction
Updated on 2025-03-10

DEDE interlaced color change and grouping line modification method

Open: inc_channel_unit_functions.php
Add to the following paragraph
Copy the codeThe code is as follows:

//zouql
//$f Total list
//$t Number of lists per group
function MyList($f,$t,$meid,$con)
{
if($meid%$t ==0 && $meid < $f)
return $con;
}

Example of use:
Copy the codeThe code is as follows:

<ul>
{dede:arclist row=20 titlelen=80 orderby=pubdate}
<li [field:global name=autoindex function='MyList("20","2",@me,"class=\"color\"")'/]>[field:textlink/]</li>
[field:global name=autoindex function='MyList("20","5",@me,"<li class=\"line\"></li>")'/]
{/dede:arclist}
</ul>

The above example contains 2 usages:
Copy the codeThe code is as follows:

[field:global name=autoindex function='MyList("20","2",@me,"class=\"color\"")'/]

and
Copy the codeThe code is as follows:

[field:global name=autoindex function='MyList("20","5",@me,"<li class=\"line\"></li>")'/]

The first one, if you define the relevant css, it is color change between lines and lines
The second one, if you define the relevant css, add a horizontal line across 5 lines, add 3 lines in 20 lists, and do not add 4 lines in the last one.
If you want to add && $meid < $f at the end, just add && $meid < $f.