如果这世上真有奇迹,那只是努力的另一个名字。人生从来没有真正的绝境。无论遭受多少艰辛,无论经历多少苦难,只要一个人的心中还怀着一粒信念的种子,那么总有一天,他就能走出困境,让生命重新开花结果。
列表页下的调用图集里的所有图片
1.把以下代码复制这个函数到/include/extend.func.php里面
//解析文章图片集
function getAllImg($typeid){
//function getAllImg($aid){
global $dsql;
$sql_arc = "SELECT imgurls FROM `idea_addonimages` where typeid=".$typeid." order by aid asc limit 1";
//$sql_arc = "SELECT imgurls FROM `idea_addonimages` where aid=".$aid." ";
$row = $dsql->GetOne($sql_arc);
$arr = explode('{dede:img',$row['imgurls']);
unset($arr['0']);
$pic = array();
for($i = 1; $i<=count($arr);$i++){
$str = substr($arr[$i],0,strpos($arr[$i],'}'));
$arr_small = explode(' ',$str);
unset($arr_small['0']);
for($j=1;$j<=count($arr_small);$j++){
$name =substr($arr_small[$j],0,strpos($arr_small[$j],'='));
$val = $arr_small[$j];
$pic[$i][$name] = trim(strstr($val,"'"),"'");
}
$begin = strpos($arr[$i],"}")+1;
$over = strpos($arr[$i],"{")-$begin;
$img = substr($arr[$i],$begin,$over);
$pic[$i]['img']=trim($img);
}
return $pic;
}
//artists图片列表
function getArtImg($id){
$pic = getAllImg($id);
$Div = "";
for($i=1;$i<=count($pic);$i++){
$Div .="<li>
//列表页用 arcurl
<a rel="nofollow noopener noreferrer" href=\&;".$pic[$i]['arcurl']."\&; title=\&;".$pic[$i]['text']."\&;>
<img src=\&;".$pic[$i]['ddimg']."\&; width=\&;150\&; alt=\&;".$pic[$i]['text']."\&; />
</a><h5>".$pic[$i]['text']."</h5>
</li>";
}
return $Div;
}
2.然后在列表模板写上标签和函数
{dede:field.id function="getArtImg(@me)"/}
文章页下的图集显示
//解析文章图片集
//function getAllImg($typeid){
function getAllImg($aid){
global $dsql;
//$sql_arc = "SELECT imgurls FROM `idea_addonimages` where typeid=".$typeid." order by aid asc limit 1";
$sql_arc = "SELECT imgurls FROM `idea_addonimages` where aid=".$aid." ";
$row = $dsql->GetOne($sql_arc);
$arr = explode('{dede:img',$row['imgurls']);
unset($arr['0']);
$pic = array();
for($i = 1; $i<=count($arr);$i++){
$str = substr($arr[$i],0,strpos($arr[$i],'}'));
$arr_small = explode(' ',$str);
unset($arr_small['0']);
for($j=1;$j<=count($arr_small);$j++){
$name =substr($arr_small[$j],0,strpos($arr_small[$j],'='));
$val = $arr_small[$j];
$pic[$i][$name] = trim(strstr($val,"'"),"'");
}
$begin = strpos($arr[$i],"}")+1;
$over = strpos($arr[$i],"{")-$begin;
$img = substr($arr[$i],$begin,$over);
$pic[$i]['img']=trim($img);
}
return $pic;
}
//artists图片文章页
function getArtImg($id){
$pic = getAllImg($id);
$Div = "";
for($i=1;$i<=count($pic);$i++){
$Div .="<li>
//列表页用 img
<a rel="nofollow noopener noreferrer" href=\&;".$pic[$i]['img']."\&; title=\&;".$pic[$i]['text']."\&;>
<img src=\&;".$pic[$i]['ddimg']."\&; width=\&;150\&; alt=\&;".$pic[$i]['text']."\&; />
</a><h5>".$pic[$i]['text']."</h5>
</li>";
}
return $Div;
}
到此这篇关于dede列表页及文章页下的调用图集里的所有图片就介绍到这了。没要腐朽没要倒退,你的眼光如婴儿般明亮,请拥抱我吧,让我的生命散发迷人的光彩,直教日月黯然。更多相关dede列表页及文章页下的调用图集里的所有图片内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!