找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 107|回复: 0

[cms教程] 织梦dedecms图集图片每张自定义输出不同样式

[复制链接]

该用户从未签到

发表于 2018-7-28 12:40:11 | 显示全部楼层 |阅读模式

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

×
如果你的图集图片要在内容页按不同的html输出每一张图片,出了CSS+js能实现,我们也可以用array runphp的方式来让每一张自定义输出
         
        效果
         
         
         
        修改教程
         
        \include\taglib\productimagelist.lib.php 找到
         
        foreach($images as $row)
         
        {
         
        中间省略...
         
        }
         
        改成
         
         
        $GLOBALS['autoindex', = 1; foreach($images as $row) { $row['autoindex', =  $GLOBALS['autoindex',; foreach($ctp->CTags as $tagid=>$ctag) { if($ctag->GetName()=='array') { $ctp->Assign($tagid,$row); } else { if(isset($row[$ctag->GetName()])){ $ctp->Assign($tagid,$row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); $GLOBALS['autoindex',++; }
        内容页图集标签
         
        {dede:productimagelist} [field:array runphp=yes, if(@me['autoindex', == 1) { @me = "{@me['autoindex',} -
[img]{@me[[/img]
\n"; } elseif(@me['autoindex', == 2) { @me = "{@me['autoindex',} -
[img]{@me[[/img]
\n"; } elseif(@me['autoindex', == 3) { @me = "{@me['autoindex',} -
[img]{@me[[/img]
\n"; } else { @me = "{@me['autoindex',} -
[img]{@me[[/img]
\n"; } [/field:array, {/dede:productimagelist}
         
         
        复杂一点的写法
         
        {dede:productimagelist} [field:array runphp=yes, if(@me['autoindex', == 2) { @me = "
[img]{@me[[/img]
"; } else { @me = ""; } [/field:array, {/dede:productimagelist}  {dede:productimagelist} [field:array runphp=yes, if(@me['autoindex', == 3) { @me = "
[img]{@me[[/img]
"; } elseif(@me['autoindex', == 4) { @me = "
[img]{@me[[/img]
"; } else { @me = ""; } [/field:array, {/dede:productimagelist}  
回复

使用道具 举报

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

GMT+8, 2024-9-29 19:31

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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