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

藏色散人
藏色散人Original
2019-12-27 09:20:071580browse

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=&#39;htmlspecialchars(@me)&#39;/]"
  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=&#39;1′ titlelen=&#39;40′ row=&#39;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!

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