帝国cms自动生成三图(实用小程序和列表模板)
作者:李志远分类:帝国cms时间:2020-11-12 11:36:00阅读:
数据库:
1.主表增加 newstextImgs 字段 在数据库里操作
2.修改文件 e/class/hinfofun.php 把下面代码放到指定位置
增加信息函数: //信息地址 $updateinfourl=''; if(!$add['isurl']) { $infourl=GotoGetTitleUrl($add['classid'],$id,$newspath,$filename,$add['groupid'],$add['isurl'],$add['titleurl']); $updateinfourl=",titleurl='$infourl'"; } //自定义 - 获取文章中图片地址集 - 增加信息 $newstextImgs=''; $newstextImgsArr = GetnewstextImgs($add['classid'],$id,4,$public_r['filedeftb']); if($newstextImgsArr){ $newstextImgs = ",newstextImgs='".$newstextImgsArr."'"; } $usql=$empire->query("update ".$infotbr['tbname']." set filename='$filename'".$updateinfourl.$addtitlepic.$newstextImgs." where id='$id'");
修改信息函数:
//更新附件 UpdateTheFileEdit($add['classid'],$add['id'],$checkr['fstb']); //自定义 - 获取文章中图片地址集 - 修改信息 $newstextImgsArr = GetnewstextImgs($add['classid'],$add['id'],4,$checkr['fstb']); if($newstextImgsArr) { $usql=$empire->query("update ".$infotbr['tbname']." set newstextImgs='".addslashes($newstextImgsArr)."' where id='$add[id]'"); }
3.修改文件 e/class/functions.php 把下面代码放到指定位置
//自定义 - 获取文章中图片地址集 function GetnewstextImgs($classid,$id,$num=3,$fstb=1){ global $empire,$dbtbpre,$public_r,$class_r; $pubid=ReturnInfoPubid($classid,$id); $num=(int)$num; $picArr_sql=$empire->query("select fileid,filename,path,id,classid,no,fpath from {$dbtbpre}enewsfile_{$fstb} where pubid='$pubid' and type=1 order by fileid limit 3"); $newstextImgs=''; while($picArr=$empire->fetch($picArr_sql)) //循环获取查询记录 { $rpath=$picArr['path']?$picArr['path'].'/':$picArr['path']; $fspath=ReturnFileSavePath($picArr[classid],$picArr[fpath]); $newstextImgs .= $fspath['fileurl'].$rpath.$picArr[filename] .'|||'; } $newstextImgs = rtrim($newstextImgs, "|||"); return $newstextImgs; }
你觉得文章内容怎么样