dedecms发布图集的具体方法如下:
1、后台创建一个image分类
2、建立文章,每个文章上传一个图片
3、/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(); if(is_array($dtp->ctags)) { foreach($dtp->ctags as $ctag) { if($ctag->getname() == 'img') { $row = 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 .= ""; } $i ; } return $result; } }
4、网页中调用
{dede:arclist row=4 typeid =13} [field:id function=getimgurls(@me,4)/] {/dede:arclist}
后者
{dede:list pagesize='10'} [field:id function=getimgurls(@me,4)/] {/dede:list}