Heim > Artikel > Backend-Entwicklung > phpcms v9中专题用的面包屑导航如何写哟
估计很多人会说用 {catpos($catid)},告诉你吧,我试了,不行,因为前提是在专题里用.
当然换了{catpos($specialid)}
也不行,难道v9专题不能用面包屑的功能,非要二次开发吗!晕
这可是最起码的功能哈
好了,如果非要二次的话,请你给指条思路
catpos本来就是用来获取栏目路径的,专题不属于栏目。下面是我改的代码,觉得可以的话就拿去吧
function catpos($catid, $symbol=' > '){ $category_arr = array(); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $category_arr = getcache('category_content_'.$siteid,'commons'); if(!isset($category_arr[$catid])) { $db = pc_base::load_model('module_model'); $info = $db->get_one('`module`=\''.$_GET['m'].'\''); return $info['name'].' '; } $pos = ''; $siteurl = siteurl($category_arr[$catid]['siteid']); $arrparentid = array_filter(explode(',', $category_arr[$catid]['arrparentid'].','.$catid)); foreach($arrparentid as $catid) { $url = $category_arr[$catid]['url']; if(strpos($url, '://') === false) $url = $siteurl.$url; $pos .= '<a href="'.$url.'">'.$category_arr[$catid]['catname'].'</a>'.$symbol; } return $pos;}
catpos本来就是用来获取栏目路径的,专题不属于栏目。下面是我改的代码,觉得可以的话就拿去吧
function catpos($catid, $symbol=' > '){ $category_arr = array(); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $category_arr = getcache('category_content_'.$siteid,'commons'); if(!isset($category_arr[$catid])) { $db = pc_base::load_model('module_model'); $info = $db->get_one('`module`=\''.$_GET['m'].'\''); return $info['name'].' '; } $pos = ''; $siteurl = siteurl($category_arr[$catid]['siteid']); $arrparentid = array_filter(explode(',', $category_arr[$catid]['arrparentid'].','.$catid)); foreach($arrparentid as $catid) { $url = $category_arr[$catid]['url']; if(strpos($url, '://') === false) $url = $siteurl.$url; $pos .= '<a href="'.$url.'">'.$category_arr[$catid]['catname'].'</a>'.$symbol; } return $pos;}
catpos本来就是用来获取栏目路径的,专题不属于栏目。下面是我改的代码,觉得可以的话就拿去吧
function catpos($catid, $symbol=' > '){ $category_arr = array(); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $category_arr = getcache('category_content_'.$siteid,'commons'); if(!isset($category_arr[$catid])) { $db = pc_base::load_model('module_model'); $info = $db->get_one('`module`=\''.$_GET['m'].'\''); return $info['name'].' '; } $pos = ''; $siteurl = siteurl($category_arr[$catid]['siteid']); $arrparentid = array_filter(explode(',', $category_arr[$catid]['arrparentid'].','.$catid)); foreach($arrparentid as $catid) { $url = $category_arr[$catid]['url']; if(strpos($url, '://') === false) $url = $siteurl.$url; $pos .= '<a href="'.$url.'">'.$category_arr[$catid]['catname'].'</a>'.$symbol; } return $pos;}
function catpos($catid, $symbol=' > '){ $category_arr = array(); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $category_arr = getcache('category_content_'.$siteid,'commons'); if(!isset($category_arr[$catid])) return ''; $pos = ''; $siteurl = siteurl($category_arr[$catid]['siteid']); $arrparentid = array_filter(explode(',', $category_arr[$catid]['arrparentid'].','.$catid)); foreach($arrparentid as $catid) { $url = $category_arr[$catid]['url']; if(strpos($url, '://') === false) $url = $siteurl.$url; $pos .= '<a href="'.$url.'">'.$category_arr[$catid]['catname'].'</a>'.$symbol; } return $pos;}
catpos本来就是用来获取栏目路径的,专题不属于栏目。下面是我改的代码,觉得可以的话就拿去吧
function catpos($catid, $symbol=' > '){ $category_arr = array(); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $category_arr = getcache('category_content_'.$siteid,'commons'); if(!isset($category_arr[$catid])) { $db = pc_base::load_model('module_model'); $info = $db->get_one('`module`=\''.$_GET['m'].'\''); return $info['name'].' '; } $pos = ''; $siteurl = siteurl($category_arr[$catid]['siteid']); $arrparentid = array_filter(explode(',', $category_arr[$catid]['arrparentid'].','.$catid)); foreach($arrparentid as $catid) { $url = $category_arr[$catid]['url']; if(strpos($url, '://') === false) $url = $siteurl.$url; $pos .= '<a href="'.$url.'">'.$category_arr[$catid]['catname'].'</a>'.$symbol; } return $pos;}
catpos本来就是用来获取栏目路径的,专题不属于栏目。下面是我改的代码,觉得可以的话就拿去吧
function catpos($catid, $symbol=' > '){ $category_arr = array(); $siteids = getcache('category_content','commons'); $siteid = $siteids[$catid]; $category_arr = getcache('category_content_'.$siteid,'commons'); if(!isset($category_arr[$catid])) { $db = pc_base::load_model('module_model'); $info = $db->get_one('`module`=\''.$_GET['m'].'\''); return $info['name'].' '; } $pos = ''; $siteurl = siteurl($category_arr[$catid]['siteid']); $arrparentid = array_filter(explode(',', $category_arr[$catid]['arrparentid'].','.$catid)); foreach($arrparentid as $catid) { $url = $category_arr[$catid]['url']; if(strpos($url, '://') === false) $url = $siteurl.$url; $pos .= '<a href="'.$url.'">'.$category_arr[$catid]['catname'].'</a>'.$symbol; } return $pos;}