示例#1
0
function get_sitemap()
{
    $_confing = get_confing($GLOBALS['lang']);
    if (empty($GLOBALS['lang'])) {
        return;
    }
    $parent = $GLOBALS['mysql']->fetch_asc("select*from " . DB_PRE . "category where cate_parent=0 and lang='" . $GLOBALS['lang'] . "' order by cate_order desc");
    $path = CMS_SELF;
    $rel = array();
    if (!empty($parent)) {
        foreach ($parent as $row) {
            $channel_info = get_cate_info($row['cate_channel'], $GLOBALS['channel']);
            //获得内容模型信息
            $list_php = empty($channel_info['list_php']) ? 'show_list.php' : $channel_info['list_php'];
            $url = $row['cate_html'] && $_confing['web_html'][0] ? $path . 'htm/' . $row['cate_fold_name'] : $path . $list_php . '?id=' . $row['id'];
            if ($row['cate_tpl'] == 3) {
                $url = $row['cate_html'] && $_confing['web_html'][0] ? $path . 'htm/' . $row['cate_fold_name'] . '/' : $path . $list_php . '?id=' . $row['id'];
            }
            $rel[$row['id']]['url'] = $url;
            $rel[$row['id']]['name'] = $row['cate_name'];
            $rel[$row['id']]['child'] = get_sitemap_child($row['id']);
        }
    }
    return $rel;
}
示例#2
0
function get_sitemap_child($id)
{
    $sql = "select * from " . DB_PRE . "category where cate_parent=" . $id . " order by cate_order desc";
    $child = $GLOBALS['mysql']->fetch_asc($sql);
    $path = CMS_SELF;
    $rel = array();
    if (file_exists(DATA_PATH . 'cache_channel/cache_channel_all.php')) {
        include DATA_PATH . 'cache_channel/cache_channel_all.php';
    }
    if (!empty($child)) {
        foreach ($child as $row) {
            $channel_info = get_cate_info($row['cate_channel'], $GLOBALS['channel']);
            //获得内容模型信息
            $list_php = empty($channel_info['list_php']) ? 'show_list.php' : $channel_info['list_php'];
            if ($row['cate_channel'] == '-9') {
                $list_php = 'order/order.php';
            }
            $url = $row['cate_html'] && $GLOBALS['_confing']['web_html'][0] ? $path . 'htm/' . $row['cate_fold_name'] : $path . $list_php . '?id=' . $row['id'];
            if ($row['cate_tpl'] == 3) {
                $url = $row['cate_html'] && $GLOBALS['_confing']['web_html'][0] ? $path . 'htm/' . $row['cate_fold_name'] . '/' : $path . $list_php . '?id=' . $row['id'];
            }
            $rel[$row['id']]['url'] = $url;
            $rel[$row['id']]['name'] = $row['cate_name'];
            $rel[$row['id']]['child'] = get_sitemap_child($row['id']);
        }
    }
    return $rel;
}