} $lang = $cate_info['lang']; if (file_exists(LANG_PATH . 'lang_' . $lang . '.php')) { include LANG_PATH . 'lang_' . $lang . '.php'; } //语言包缓存,数组$language if (file_exists(DATA_PATH . 'cache_cate/cate_list_' . $lang . '.php')) { include DATA_PATH . 'cache_cate/cate_list_' . $lang . '.php'; } //当前语言下的栏目 $_confing = get_confing($lang); //配置信息 $cat_id = $cate_info['id']; //栏目id $cateid = $cat_id; $parent_id = get_cate_last_parent($cat_id); //获取最终顶级栏目 $tpl->template_dir = TP_PATH . $_confing['web_template'] . '/'; $tpl->template_lang = $lang; if ($_confing['is_cache']) { $tpl->template_is_cache = 1; //缓存 $tpl->template_time = $_confing['cache_time'] ? $_confing['cache_time'] : 30; //开启缓存但不存在缓存时间使用30秒 } else { $tpl->template_is_cache = 0; } //开始列表 $child = get_child_id($cat_id); $list_cate = empty($child) ? $cat_id : $cat_id . $child; //所有栏目包含子栏目
function get_cate_last_parent($cateid) { if (empty($cateid)) { return; } $sql = "select cate_parent from " . DB_PRE . "category where id = " . $cateid; $rel = $GLOBALS['mysql']->fetch_asc($sql); $parent = $rel[0]['cate_parent']; if (!$parent) { return $cateid; } else { return get_cate_last_parent($parent); } }