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

效果

修改教程

\include\taglib\productimagelist.lib.php找到

foreach($images as $row)

{

中间省略...

}

改成

$GLOBALS['autoindex']=1;
foreach($imagesas$row)
{
	$row['autoindex']=$GLOBALS['autoindex'];
	foreach($ctp->CTagsas$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:arrayrunphp=yes]
		if(@me['autoindex']==1)
		{
			@me="<strong>{@me['autoindex']}-<imgsrc='{@me['imgsrc']}'></strong>\n";
		}
		elseif(@me['autoindex']==2)
		{
			@me="<p>{@me['autoindex']}-<imgsrc='{@me['imgsrc']}'></p>\n";
		}
		elseif(@me['autoindex']==3)
		{
			@me="<span>{@me['autoindex']}-<imgsrc='{@me['imgsrc']}'></span>\n";
		}
		else
		{
			@me="<div>{@me['autoindex']}-<imgsrc='{@me['imgsrc']}'></div>\n";
		}
	[/field:array]
{/dede:productimagelist}

复杂一点的写法

<ulclass="tuzsclearfix">
	{dede:productimagelist}
	[field:arrayrunphp=yes]
		if(@me['autoindex']==2)
		{
			@me="<liclass='leftlab'style='height:914px'><divclass='huise'></div><imgsrc='{@me['imgsrc']}'></li>";
		}
		else
		{
			@me="";
		}
	[/field:array]
	{/dede:productimagelist}
	<liclass="rightlab">
	{dede:productimagelist}
		[field:arrayrunphp=yes]
			if(@me['autoindex']==3)
			{
				@me="<divclass='rtup'style='height:457px'><divclass='huise'></div><imgsrc='{@me['imgsrc']}'></div>";
			}
			elseif(@me['autoindex']==4)
			{
				@me="<divclass='rtdn'style='height:457px'><divclass='huise'></div><imgsrc='{@me['imgsrc']}'></div>";
			}
			else
			{
				@me="";
			}
		[/field:array]
	{/dede:productimagelist}
	</li>
</ul>

免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。