Example #1
0
/**
 * 递归获取上级栏目集合
 */
function parentids($catid, $cats)
{
    if (empty($catid)) {
        return false;
    }
    $catids = $catid . ',';
    if ($cats[$catid]['parentid']) {
        $catids .= parentids($cats[$catid]['parentid'], $cats);
    }
    return $catids;
}
Example #2
0
 protected function get_title($catid)
 {
     $catids = parentids($catid, $this->category_cache);
     $catids = explode(',', $catids);
     $title = '';
     foreach ($catids as $t) {
         if ($t) {
             $title .= $this->category_cache[$t]['catname'] . ' - ';
         }
     }
     return $title;
 }