添加字段首页无法调用出图片
1.首页调用
{dede:arclist addfields='字段英文名' channelid='模型ID' row='条数' type='栏目ID' typeid='1' row='3' titlelen='100'}[field:字段英文名/]{dede:arclist} {dede:arclist addfields='quyu,ditie,huanxian,shangquan,zujin,miaoshu,mianji' channelid='17' row='10' orderby='id'}
在./include/extend.func.php最后添加自定义函数
function GetOneImgUrl( $img, $ftype = 1 ) { if ($img <> '') { $dtp = new DedeTagParse(); $dtp->LoadSource( $img ); if (is_array( $dtp->CTags )) { foreach ($dtp->CTags as $ctag) { if ($ctag->GetName() == 'img') { $width = $ctag->GetAtt( 'width' ); $height = $ctag->GetAtt( 'height' ); $imgurl = trim( $ctag->GetInnerText() ); $img = ''; if ($imgurl != '') { if ($ftype == 1) { $img .= $imgurl; //不带标签 } else { $img .= ''; // 带标签 } } } } } $dtp->Clear(); return $img; } }
以后就这么调用 [field:touxiangzhaopian function='GetOneImgUrl(@me,1)'/] 1 为不带html标签的,0为带html标签的。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)