織夢(mèng)dedecms模板中的dede:arclist 首頁標(biāo)簽調(diào)用和dede:list 列表頁標(biāo)簽調(diào)用
[field:id function="Getimg(@me,80,80,7)" /]
織夢(mèng)cms模板文章內(nèi)頁調(diào)用
{dede:field.id function="Getimg(@me,80,80,7)" /}
這里的80和80和7分別是要顯示圖片的寬度(省略為110)和高度(省略為110)和調(diào)用張數(shù)(省略為所有((0)),
這里還需要在 include/common.func.php增加一仿站函數(shù)
function Getimg($aid,$imgwith=110,$imgheight=110,$num=0)
{
global $dsql;
$imgurls = '';
$row =$dsql->getone( "Select imgurls From `dede_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++){
$imglist.="<li><img src=".trim($wordcount[2][$i])." width=".$imgwith." height=".$imgheight."></li>";
}
return $imglist;
}
因?yàn)槿豪飩€(gè)別人說UTF-8用上面的不行,所以添加下面的
function Getimgs($aid, $imgwith = 300, $imgheight = 270, $num = 0, $style = ''){
global $dsql;
$imgurls = '';
$row = $dsql -> getone("Select imgurls From`dede_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 .= "<li><ahref=#" . $i . "><imgsrc=". trim($wordcount[2][$i]) . " width=" . $imgwith . " height=" . $imgheight . "></li></a>";
}else{
$imglist .= "<li><a href=" . trim($wordcount[2][$i]) . "><img src= " . trim($wordcount[2][$i]) . " width='" . $imgwith . "' height='" . $imgheight . "'></a></li>";
}
}
return $imglist;
}
內(nèi)容頁調(diào)用{dede:field.id function="Getimgs(@me,425,559,10)" /}
OK,織夢(mèng)cms模板首頁,列表頁調(diào)用dede圖集就完成了。