找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 112|回复: 0

[cms教程] 织梦dede列表页实现隔行_多行随意换色

[复制链接]

该用户从未签到

发表于 2020-4-15 10:28:27 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

×
标签说明:
        arclist 标签下使用 [field:global.autoindex/, 默认从1开始
        channel 标签下使用 [field:global.autoindex/, 默认从0开始
        channelartlist 标签下使用 {dede:global.itemindex/} 默认从1开始
         
        arclist 从0开始[field:global name=autoindex runphp="yes",@me=@me-1;[/field:global,
        channel 从1开始[field:global name=autoindex runphp="yes",@me=@me+1;[/field:global,[field:typename/,
        channelartlist 从0开始{dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global}
         
        channelartlist 标签下使用 {dede:global name='itemindex' runphp='yes'}@me;{/dede:global}
        隔行换色(增加样式),list同arclist
       
         
          {dede:list pagesize='50'}
          [*,
           [field:global runphp='yes' name=autoindex,
           $a="";
           $b="";
           if ((@me%2)==0) @me=$a;
           else @me=$b;
           [/field:global,
          [[field:typelink/,,[field:pubdate function="MyDate('Y-m-d',@me)"/,
          [url=,[field:title /,[/url]
          
         {/dede:list}
       

       
             如果运用channel弄隔行换色,需要自增从1开始,精简写法如下:
       
          
          {dede:channel row=6 typeid=''}
          [field:global name=autoindex runphp="yes",((@me+1) % 2 == 0)?@me="":@me="[*,";[/field:global,
           [field:title/,
          
          {/dede:channel}
         

       
        隔3行(n行)换色(增加样式)精简写法,替换橙色字体部分
         
          
          {dede:arclist row=6 typeid=''}
          [field:global name=autoindex runphp="yes",(@me % 3 == 0)?@me="":@me="[*,";[/field:global,
           [field:title/,
          
          {/dede:arclist}
         

       
        多行随意换色(增加样式)
              如果想随机生成彩色/样式,可以参考文章《dede优化方法整理之:tag标签》
         
            
             {dede:arclist typeid='8' row='6' orderby='weight'}
             [field:global runphp='yes' name=autoindex,
              $a="";
              $b="";
              $c="";
              $d="";
              $e="";
              $f="";
              if ((@me/1)==1) @me=$a;     
              else if ((@me/2)==1) @me=$b;
              else if ((@me/3)==1) @me=$c;
              else if ((@me/4)==1) @me=$d;
              else if ((@me/5)==1) @me=$e;
              else if ((@me/6)==1) @me=$f;
             [/field:global,
             
               [url=,
[img][/img]
[/url]
               [url=[field:arcurl/,,[field:title/,[/url]

             
             
             {/dede:arclist}
            

       
        精简写法
         
          
          {dede:arclist row=6 typeid=''}
          
           [field:title/,
          
          {/dede:arclist}
         

       
        公共css样式部分
              这里注意每张图的在调用的时候width和height可以为空,如果是或者乱填都没关系,靠样式进行定义。
       
        .gd1{width:750px;height:330px}
        .gd2{width:370px;height:165px}
        .gd3{width:185px;height:165px}
        .gd4{width:185px;height:165px}
        .gd5{width:335px;height:247px}
        .gd6{width:335px;height:247px}
        .gd1 img{width:750px;height:330px}
        .gd2 img{width:370px;height:165px}
        .gd3 img{width:185px;height:165px}
        .gd4 img{width:186px;height:165px}
        .gd5 img{width:335px;height:247px}
        .gd6 img{width:335px;height:247px}
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-10-7 08:25

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表