dedecms織夢圖集在首頁列表頁調用并且自定義輸出
導讀:織夢教程織夢教程效果 不改動官方核心文件,在自定義方法文件里加入個方法來實現 打開 \include\extend.func.php 在最下面加入這個方法 function G織夢文章模板夢織模板。
效果
不改動官方核心文件,在自定義方法文件里加入個方法來實現
打開 \include\extend.func.php 在最下面加入這個方法
function Getimgurls($aid,$num=4)
{
global $dsql;織夢模板免費
$imgurls = $result = '';
$imgrow = $dsql->GetOne( "Select imgurls From `dede_addonimages` where aid='$aid' ");
$imgurls = $imgrow['imgurls'];
if($imgurls != '')
{
$dtp = new DedeTagParse();
$dtp->LoadSource($imgurls);
$images = array();
&織夢模板安裝nbsp; if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $ctag)
{
if($ctag->GetName() == 'img')
{
$ro織夢手機模板w = array();
$row['width'] = $ctag->GetAtt('width');
$row['height'] = $ctag->GetAtt('height');
$row['imgsrc'] = trim($ctag->GetInnerText());
$row['text'] = $ctag->GetAtt('text');
$images[] = $row;
}
}
}
$dtp->Clear();
$i = 0;
foreach($images as $row)
{
if($i == $num) break;
if($row['imgsrc'] != '')
{
$result .= "<li><div class='pic'><a title='{$row['text']}' href='{$row['imgsrc']}'><img src='{$row['imgsrc']}' mid='{$row['imgsrc']}' big='{$row['imgsrc']}' width='70' height='70'></a></div></li>";
}
$i++;
}
return $result;
}
}
上面代碼中標紅的地方改成你自己的,注意單雙引號
前臺模板 首頁 或者 列表頁 中調用
[field:id function=Getimgurls(@me,4)/]
數字4是調用幾張圖片
本文來源于:http://www.cnblogs.com/dedediy/p/7039910.html Power by dedediy相關織夢文章模板夢織模板。
聲明: 本文由我的SEOUC技術文章主頁發布于:2023-07-18 ,文章dedecms織夢圖集在首頁列表頁調用并且自定義輸出主要講述自定義,幾張,織夢網站建設源碼以及服務器配置搭建相關技術文章。轉載請保留鏈接: http://www.bifwcx.com/article/web_29163.html