织梦CMS/Dedecms添加自定义函数

,添加自定义函数文件:include/extend.func.php,实例:,//通过会员ID查看会员名称的函数 ,function GetMemberName($str){ 
$dsql = new Dedesql(false); 
$row = $dsql->GetOne("SELECT uname FROM `ddmx_member` WHERE mid = '$str' "); 
return $row[uname]; 
},前台模板调用[field:mid function="GetMemberName(@me)"/],//通过ID号获取类别的链接
function GetTypeUrl($tid)
{
 global $dsql;
 global $cfg_cmspath;, $query ="select typedir from ‘#` where ;, if($row=$dsql->getone($query))
 {
  $temp=str_replace("{cmspath}",$cfg_cmspath,$row['typedir']).'/';
 }
 return $temp;
},//通过ID号获取文章的链接
function zGetArticleUrl($id)
{
 global $dsql;
 global $cfg_cmspath;
 $query ="select id,typedir,namerule from ‘#` where typeid from ‘#` where ; 
 if($row = $dsql->getone($query))
 {  
  $arc=$row['namerule'];
  $type=str_replace("{cmspath}",$cfg_cmspath,$row['typedir']);
  $temp=str_replace("{typedir}",$type,$temp);
  $temp=str_replace("{aid}",$id,$temp);
 }
 return $temp;
},
返回顶部
跳到底部

Copyright 2011-2024 南京追名网络科技有限公司 苏ICP备2023031119号-6 乌徒帮 All Rights Reserved Powered by Z-BlogPHP Theme By open开发

请先 登录 再评论,若不是会员请先 注册