Home > Article > CMS Tutorial > How to add horizontal lines every 5th row in DedeCMS article list
How to add horizontal lines every 5th row in DedeCMS article list?
I have seen that on some websites, in certain article lists, such as the recommended article section, the article list on a whole page will look a bit messy, with articles listed in each line or every N lines. Insert horizontal lines, it looks pretty good, so here I found two methods to share with you
Recommended learning: 梦Weavercms
Method 1:
The code is as follows:
{dede:arclist typeid='1′ titlelen='40′ row='20′ typeid="" } ·<a class="syh" href=https://www.xxx.net/"[field:arcurl /]" title="[field:title function='htmlspecialchars(@me)'/]" target=_blank>[field:title function="cn_substr(@me,48)"/]</a> [field:global name=autoindex runphp="yes"]if(@me%10==0)@me="<hr /> "; else @me=""; [/field:global] {/dede:arclist}
If you define relevant css, such as: "syh", it will change color on alternate lines
Method 2:
The code is as follows:
{dede:arclist typeid='1′ titlelen='40′ row='20′ typeid="" } <li><a href=https://www.xxx.net/"[field:arcurl/]">[field:title/]</a></li> [field:global name=autoindex runphp="yes"](@me % 5 == 0)?@me="<li class=\"bline\"></li>":@me="";[/field:global]{/dede:arclist}
If you define relevant css, add a horizontal line every 5 lines. For 20 lists, add three lines instead of four. Generally, there is no need to add a separator line for the last one. If you want to add a separator line at the end, remove it.
The above is the detailed content of How to add horizontal lines every 5th row in DedeCMS article list. For more information, please follow other related articles on the PHP Chinese website!