dede:arclist 标签调用和dede:list 列表调用
1
[field:id function="Getimg(@me,80,80,7)" /]
文章内页调用
1
{dede:field.id function="Getimg(@me,80,80,7)" /}
80和80和7分别是要显示图片的宽度(省略为110)和高度(省略为110)和调用张数(省略为所有((0)),
include/common.func.php增加一函数
01
function Getimg($aid,$imgwith=110,$imgheight=110,$num=0)
02
{
03
global $dsql;
04
$imgurls = '';
05
$row =$dsql->getone( "Select aid,imgurls From `dede_addonimages` where aid='$aid' ");
06
$id=$row['aid'];
07
$imgurls= $row['imgurls'];
08
$dtp = new DedeTagParse();
09
$dtp->LoadSource($imgurls);
10
if(is_array($dtp->CTags))
11
{
12
$i=0;
13
foreach($dtp->CTags as $ctag)
14
{
15
if($i<$num){
16
if($ctag->GetName()=="img")
17
{
18
$bigimg = trim($ctag->GetInnerText());
19
if($ctag->GetAtt('ddimg') != $bigimg && $ctag->GetAtt('ddimg')!='')
20
{
21
$litimg = $ctag->GetAtt('ddimg');
22
}
23
$title=$ctag->GetAtt('text');
24
$imglist.='<li><a title="'.$title.'" href="/plus/view.php?aid='.$id.'"><img src="'.$bigimg.'" width="'.$imgwith.'" height="'.$imgheight.'" alt="'.$title.'"></a></li>';
25
$i++;
26
}
27
}
28
}
29
}
30
return $imglist;
31
32
}