$all .= $this->footer; return $all; } } define('IN_ECS', true); define('INIT_NO_USERS', true); define('INIT_NO_SMARTY', true); require dirname(__FILE__) . '/includes/init.php'; if (file_exists(ROOT_PATH . DATA_DIR . '/sitemap.dat') && time() - filemtime(ROOT_PATH . DATA_DIR . '/sitemap.dat') < 86400) { $out = file_get_contents(ROOT_PATH . DATA_DIR . '/sitemap.dat'); } else { $site_url = rtrim($ecs->url(), '/'); $sitemap = new sitemap(); $config = unserialize($_CFG['sitemap']); $item = array('loc' => "{$site_url}/", 'lastmod' => local_date('Y-m-d'), 'changefreq' => $config['homepage_changefreq'], 'priority' => $config['homepage_priority']); $sitemap->item($item); /* 商品分类 */ $sql = 'SELECT cat_id,cat_name FROM ' . $ecs->table('category') . ' ORDER BY parent_id'; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $item = array('loc' => "{$site_url}/" . build_uri('category', array('cid' => $row['cat_id']), $row['cat_name']), 'lastmod' => local_date('Y-m-d'), 'changefreq' => $config['category_changefreq'], 'priority' => $config['category_priority']); $sitemap->item($item); } /* 文章分类 */ $sql = 'SELECT cat_id,cat_name FROM ' . $ecs->table('article_cat') . ' WHERE cat_type=1'; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $item = array('loc' => "{$site_url}/" . build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']), 'lastmod' => local_date('Y-m-d'), 'changefreq' => $config['category_changefreq'], 'priority' => $config['category_priority']); $sitemap->item($item); } /* 商品 */