Warning: Undefined array key "night" in /www/wwwroot/dhaomu.com/wp-content/themes/b2/header.php on line 18

织梦图集图片每张自定义输出不同样式

dedecms教程:织梦教程dedecms图集图片每张自定义输出不同样式!如果你的图集图片要在内容页按不同的html输出每一张图片,出了CSS+js能实现,我们也可以用array runphp的方式来让每一张自定义输出

dedecms教程:织梦教程dedecms图集图片每张自定义输出不同样式!如果你的图集图片要在内容页按不同的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 = "<strong>{@me['autoindex']} - <img src='{@me['imgsrc']}'></strong>\n"; } elseif(@me['autoindex'] == 2) { @me = "<p>{@me['autoindex']} - <img src='{@me['imgsrc']}'></p>\n"; } elseif(@me['autoindex'] == 3) { @me = "<span>{@me['autoindex']} - <img src='{@me['imgsrc']}'></span>\n"; } else { @me = "<div>{@me['autoindex']} - <img src='{@me['imgsrc']}'></div>\n"; } [/field:array] {/dede:productimagelist}

复杂一点的写法

<ul class="tuzs clearfix"> {dede:productimagelist} [field:array runphp=yes] if(@me['autoindex'] == 2) { @me = "<li class='leftlab' style='height:914px'><div class='huise'></div> <img src='{@me['imgsrc']}'> </li>"; } else { @me = ""; } [/field:array] {/dede:productimagelist} <li class="rightlab"> {dede:productimagelist} [field:array runphp=yes] if(@me['autoindex'] == 3) { @me = "<div class='rtup' style='height:457px'><div class='huise'></div><img src='{@me['imgsrc']}'> </div>"; } elseif(@me['autoindex'] == 4) { @me = "<div class='rtdn' style='height:457px'><div class='huise'></div><img src='{@me['imgsrc']}'> </div>"; } else { @me = ""; } [/field:array] {/dede:productimagelist} </li> </ul>
温馨提示:
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:duhaomu@163.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明

给TA赞赏
共{{data.count}}人
人已赞赏
编程技巧

PbootCMS模板邮件配置修改发件人信息

2022-5-12 0:00:00

编程技巧

PbootCMS网站如何取消后台、留言、自定义表单验证码

2022-5-13 9:00:00

0 条回复 A文章作者 M管理员

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914
----《》
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索