如果你的图集图片要在内容页按不同的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>[email protected]['autoindex']} - <img src='[email protected]['imgsrc']}'></strong>\n"; } elseif(@me['autoindex'] == 2) { @me = "<p>[email protected]['autoindex']} - <img src='[email protected]['imgsrc']}'></p>\n"; } elseif(@me['autoindex'] == 3) { @me = "<span>[email protected]['autoindex']} - <img src='[email protected]['imgsrc']}'></span>\n"; } else { @me = "<div>[email protected]['autoindex']} - <img src='[email protected]['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='[email protected]['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='[email protected]['imgsrc']}'> </div>"; } elseif(@me['autoindex'] == 4) { @me = "<div class='rtdn' style='height:457px'><div class='huise'></div><img src='[email protected]['imgsrc']}'> </div>"; } else { @me = ""; } [/field:array] {/dede:productimagelist} </li> </ul>


THE END

非特殊说明,本博所有文章均为博主原创

如若转载,请注明出处:https://www.htmlbk.com/dedecms/101.html