今天在用phpcms写博客需要用到当前位置,本想自己写一个函数在实现当前位置的,结果发现phpcms已经内定写好了一个函数直接调用即可{catpos($catid)}
相关函数:
function catpos($catid, $urlrule = '') { global $CATEGORY; if(!isset($CATEGORY[$catid])) return ''; $pos = ''; $arrparentid = array_filter(explode(',', $CATEGORY[$catid]['arrparentid'].','.$catid)); foreach($arrparentid as $catid) { if($urlrule) eval("$url = "$urlrule";"); else $url = $CATEGORY[$catid]['url']; $pos .= ''.$CATEGORY[$catid]['catname'].''; } return $pos; }