DedeCms 获得文档静态地址函数 2009/05/04 开发杂文hidehai发表留言 DedeCms UTF8 v5.3 获得文档静态地址的函数,在绝大多数情况下适用。 <? //获得文档的静态页面url地址 //By: hidehai function GetinfoUrl($id,$limit) { global $dsql; $infoUrl = 'http://www.0x32.cn; $typename = ''; $typedir = '' ; $userip = '' ; $title = '' ; $y=0; $md=0; // $d=0; $query = "select type.id as ida,type.typename,type.typedir,type.namerule,archive.id as idb,archive.typeid,archive.title,archive.senddate,archive.click From #@__archives as archive,#@__arctype as type where type.id=archive.typeid and archive.id=$id and archive.arcrank=0 limit 0,$limit;"; $dsql->Execute('me',$query); while($arr = $dsql->GetArray()) { $id = $arr['ida']; $idb = $arr["idb"]; $userip = $arr["userip"]; $title = $arr["title"]; $y=MyDate("%y",$arr['senddate']); $md=MyDate("%m%d",$arr['senddate']); $namerule = $arr["namerule"]; $typedir = $arr["typedir"]; } $typedir=str_replace("{cmspath}","",$typedir); $namerule=str_replace("{typedir}", $typedir,$namerule); $namerule=str_replace("{Y}","20".$y,$namerule); $namerule=str_replace("{M}{D}", $md,$namerule); $namerule=str_replace("{aid}",$idb,$namerule); $infoUrl = $namerule; $infoUrl = str_replace("%","",$infoUrl); return $infoUrl; } Related posts: 一段php分页代码 Mysql对大量查询的优化 DedeCms 根据IP显示地址 简单div的隐藏显示代码