1、打開 include/extend.func.php 文件,並添加如下代碼:
function Get_BodyImg($aid){
global $dsql;
$query = "select body FROM `dede_addonarticle` where aid='$aid'";
$dsql->Execute('body',$query);
$row = $dsql->GetArray('body');
preg_match('/<img(.*)>/i',$row['body'],$str);
$GImgs = $str[0];
//echo $GImgs;
return $GImgs;
}
2、打開 include/taglib/arclist.lib.php 文件,並在513行添加如下代碼:
$row['first_imgurl'] = Get_firstbigimg($row['id']);
3、調用方法:
然後在模板裡循環調用:
[field:litpic function=first_imgurl('@me')/]
如要直接調用用:
{dede:field name='litpic' function="first_imgurl(@me)"/}
*