dede织梦获取文章里第一张图片
global $dsql;
$str_sub=substr($str_pic,0,-7).".jpg";//删除缩略图字符串最后七位,然后再补上后缀.jpg
$dsql->Execute('body',$query);
模板里调用
/**
{dede:field name='litpic' function="firstimg(@me)"/}
* 获得某文档的第一个图片
return $str_sub;
* @return string
{
{
$row = $dsql->GetArray('body');
}
function GetImgs($aid)
[field:litpic function=firstimg('@me')/]
return $GImgs;
//echo $GImgs;
*
$query = "select body FROM `dede_addonarticle` where aid='$aid'";
preg_match('/<img(.*)>/i',$row['body'],$str);
如要直接调用用:
*/
//取第一张图地址
1、在include/helpers/archive.helper.php
2、include/extend.func.php
}
function firstimg($str_pic)
* @param int $aid 文档id
}
[field:id function=GetImgs(@me)/]
$GImgs = $str[0];
然后在模板里循环调用:
if( ! function_exists('GetImgs'))
{
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jz/dedecms/4155.shtml
相关文章
热门TAG
win10 ecshop 主机 阿里云 解决 配置 C# C++ 解析 SQL语句 命令 Go语言 方法 CSS3 HTML5 CSS win7 MSSQL 服务器配置 IIS7.5 IIS7 IIS6 IIS CentOS 7 Linux oracle数据库 oracle phpcms discuz discuz教程最新文章
-
dedecms上传透明配景图片酿
时间:2021-01-12
-
织梦DEDECMS V6安装后报错打
时间:2021-01-12
-
保障Dede生态的安全、完整
时间:2021-01-12
-
织梦官方将通过赠送商业
时间:2021-01-12
-
则需要先导入数据
时间:2021-01-12
-
在点击系统设置里面的图
时间:2021-01-12
-
利用织梦cms做多语言的网
时间:2021-01-12
-
DEDECMS登录后台慢的完美解
时间:2021-01-12
热门文章
-
DedeCMS站点高级安全策略(Linux篇)
时间:2020-12-16
-
阿里云主机安装织梦系统出现data无写入权
时间:2020-12-17
-
织梦教程:织梦怎么整合Discuz站点
时间:2020-12-14
-
织梦批量删除文章内容数据库里所有超链
时间:2020-12-17
-
织梦dedecms系统UTF8版编辑器中多图发布按
时间:2020-12-16
-
织梦更换UEditor编辑器后栏目内容、单页无
时间:2020-12-17
-
利用织梦cms做多语言的网站(图解)
时间:2021-01-12
-
织梦关键词自动添加链接设置方法
时间:2020-12-15
-
如何防止别人盗用你的织梦模板
时间:2020-12-14
-
织梦dedecms熊掌号时间因子改造教程
时间:2020-12-13
