在PHPCMS的安装目录下,打开\phpcms\libs\functions\global.func.PHP

 

 1 /**
 2  * 当前路径
 3  * 返回指定栏目路径层级
 4  * @param $catid 栏目id
 5  * @param $symbol 栏目间隔符
 6  */
 7 function catpos($catid, $symbol=' > '){
 8     $category_arr = array();
 9     $siteids = getcache('category_content','commons');
10     $siteid = $siteids[$catid];
11     $category_arr = getcache('category_content_'.$siteid,'commons');
12     if(!isset($category_arr[$catid])) return '';
13     $pos = '';
14     $siteurl = siteurl($category_arr[$catid]['siteid']);
15     $arrparentid = array_filter(explode(',', $category_arr[$catid]['arrparentid'].','.$catid));
16     foreach($arrparentid as $catid) {
17         $url = $category_arr[$catid]['url'];
18         if(strpos($url, '://') === false) $url = $siteurl.$url;
19         $pos .= '<a href="'.$url.'">'.$category_arr[$catid]['catname'].'</a>'.$symbol;
20     }
21     $pos = '<a href="{siteurl($siteid)}">首页</a>'.$symbol.substr($pos,0,-1*strlen($symbol));  
22     return $pos;
23 }

 

相关文章:

  • 2021-12-09
  • 2021-08-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2021-09-12
  • 2022-12-23
  • 2022-02-02
  • 2021-05-29
相关资源
相似解决方案