$smarty_q->assign("author_profession_de", $quotes_temp[0]["author_profession_de"]); $smarty_q->assign("author_name_freeform_et", $quotes_temp[0]["author_name_freeform_et"]); $smarty_q->assign("author_name_freeform_en", $quotes_temp[0]["author_name_freeform_en"]); $smarty_q->assign("author_name_freeform_de", $quotes_temp[0]["author_name_freeform_de"]); $smarty_q->assign("url_friendly_author_name_et", $quotes_temp[0]["url_friendly_author_name_et"]); $smarty_q->assign("url_friendly_author_name_en", $quotes_temp[0]["url_friendly_author_name_en"]); $smarty_q->assign("url_friendly_author_name_de", $quotes_temp[0]["url_friendly_author_name_de"]); $smarty_q->assign("author_wiki_url_et", $quotes_temp[0]["author_wiki_url_et"]); $smarty_q->assign("author_wiki_url_en", $quotes_temp[0]["author_wiki_url_en"]); $smarty_q->assign("author_wiki_url_de", $quotes_temp[0]["author_wiki_url_de"]); break; case "generate_indexes": acl(); tag::generate_index(); robots::generate("robots_".$config_q["locale"].".txt"); sitemap::generate("sitemap_".$config_q["locale"].".xml"); die("done"); break; case "find_similar_quotes": acl(); quote::find_similar_quotes(); break; case "get_new_quotes_from_zitate_de": acl(); quote::get_new_quotes_from_zitate_de(); break; case "admin": acl(); echo "admin"; break; case "userprofile":
$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); } /* 商品 */ $sql = 'SELECT goods_id, goods_name, last_update FROM ' . $ecs->table('goods') . ' WHERE is_delete = 0 LIMIT 300'; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $item = array('loc' => "{$site_url}/" . build_uri('goods', array('gid' => $row['goods_id']), $row['goods_name']), 'lastmod' => local_date('Y-m-d', $row['last_update']), 'changefreq' => $config['content_changefreq'], 'priority' => $config['content_priority']); $sitemap->item($item); } /* 文章 */ $sql = 'SELECT article_id,title,file_url,open_type, add_time FROM ' . $ecs->table('article') . ' WHERE is_open=1'; $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $article_url = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']); $item = array('loc' => "{$site_url}/" . $article_url, 'lastmod' => local_date('Y-m-d', $row['add_time']), 'changefreq' => $config['content_changefreq'], 'priority' => $config['content_priority']); $sitemap->item($item); } $out = $sitemap->generate(); file_put_contents(ROOT_PATH . DATA_DIR . '/sitemap.dat', $out); } if (function_exists('gzencode')) { header('Content-type: application/x-gzip'); $out = gzencode($out, 9); } else { header('Content-type: application/xml; charset=utf-8'); } die($out);
<?php require_once 'kernel/lib/sitemap/sitemap.php'; $sitemap = new sitemap(); echo $sitemap->generate('http://digiseo.ir');