在图片集页面如何输出全部图片?下面的代码只能输出一张图片{dede:field name='imgurls' alt='图片输出区'}
<div><img src="[field:imgsrc/]" alt="[field:title function='html2text(@me)'/]" width="534" height="336"/></div>
<div><center>[field:alttext/]</center></div>
{/dede:field}各位大侠帮帮忙,先谢了
<div><img src="[field:imgsrc/]" alt="[field:title function='html2text(@me)'/]" width="534" height="336"/></div>
<div><center>[field:alttext/]</center></div>
{/dede:field}各位大侠帮帮忙,先谢了
可以吗
function Getimg($aid, $imgwith = 344, $imgheight = 450, $num = 0 , $style = 'li')
{
global $dsql;
$imgurls = '';
$row = $dsql -> getone("Select imgurls From`#@__addonimages` where aid='$aid'"); //
$imgurls = $row['imgurls'];
preg_match_all("/{dede:img (.*)}(.*){\/dede:img/isU", $imgurls, $wordcount);
$count = count($wordcount[2]);
if ($num > $count || $num == 0)
{
$num = $count;
}
for($i = 0;$i < $num;$i++)
{
if($style == 'li')
{
$imglist .= "<a href=#" . $i . "><img src=". trim($wordcount[2][$i]) . " width=" . $imgwith . " height=" . $imgheight . "></a>";
}
}
return $imglist;
} 然后在列表模版中使用 {dede:list}
[field:id function="Getimg(@me,344,400,9)" /]
{/dede:list}调用
在文章模版中使用 {dede:field.id function="Getimg(@me,344,400,9)" /}调用
希望能帮助你