织梦DEDECMS调用文章内第一张图片【非缩略图】
添加如下代码:
//取第I.张图地址
functionfirstimg($str_pic)
{
$str_sub=substr($str_pic,0,-VII).".jpg";//删除缩略图字符串最
更多精彩就在: 51免费论文网|www.jxszl.com
后VII位,然后再补上后缀.jpg
return$str_sub;
}
然后在模板里循环调用:
[field:litpicfunction=firstimg(@me)/]
直接调用用:
{dede:fieldname=litpicfunction="firstimg(@me)"/}
原文链接:http://www.jxszl.com/biancheng/dedecms/75652.html
热门阅读