public function sitmap() { $this->load->library('Sitemap'); // 基礎設定 $domain = 'http://www.zeusdesign.com.tw'; $sit_map = new Sitemap($domain); $sit_map->setPath(FCPATH . 'sitemap' . DIRECTORY_SEPARATOR); $sit_map->setDomain($domain); // main pages $sit_map->addItem('/', '0.5', 'weekly', date('c')); $sit_map->addItem('/abouts/', '0.5', 'weekly', date('c')); $sit_map->addItem('/contacts/', '0.5', 'weekly', date('c')); $sit_map->addItem('/works/', '0.8', 'daily', date('c')); $sit_map->addItem('/articles/', '0.8', 'daily', date('c')); // all articles foreach (Article::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_visibled = ? AND destroy_user_id IS NULL', Article::IS_VISIBLED))) as $article) { $sit_map->addItem('/article/' . $article->site_show_page_last_uri(), '1', 'daily', $article->updated_at->format('c')); } // all article tags foreach (ArticleTag::all(array('select' => 'id')) as $tag) { $sit_map->addItem('/article-tag/' . $tag->id . '/articles/', '0.8', 'daily', date('c')); } // all works foreach (Work::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_enabled = ? AND destroy_user_id IS NULL', Work::ENABLE_YES))) as $work) { $sit_map->addItem('/work/' . $work->site_show_page_last_uri(), '1', 'daily', $work->updated_at->format('c')); } // all work tags foreach (WorkTag::all(array('select' => 'id')) as $tag) { $sit_map->addItem('/work-tag/' . $tag->id . '/works/', '0.8', 'daily', date('c')); } $sit_map->createSitemapIndex($domain . '/sitemap/', date('c')); }
public static function createXMLSiteMap() { $domain = str_ireplace('www.', '', $_SERVER["HTTP_HOST"]); if (!file_exists("../sitemap.xml") && file_exists("../robots.txt")) { $file = '../robots.txt'; $siteMapLine = "\n\nSitemap: http://" . $domain . '/sitemap.xml'; file_put_contents($file, $siteMapLine, FILE_APPEND); } $siteMap = new Sitemap('http://' . $domain . '/'); $siteMap->setPath('../'); $blogData = new BlogData(); $postPageName = $blogData->getPostPageName(); $siteMap->addItem('', '1', 'daily'); $pagesData = new PagesData(); $pages = $pagesData->getData(); foreach ($pages as $page) { if ($page != $postPageName && $page != 'error' && $page != 'index') { $siteMap->addItem($page . '/', '0.5', 'daily'); } } $blogList = $blogData->getBlogList(); if (!empty($blogList)) { foreach ($blogList as $blog) { if (isset($blog['published'])) { $siteMap->addItem($postPageName . '/' . $blog['external'] . '/', '1', 'monthly'); } } } $siteMap->createSitemapIndex('http://' . $domain . '/', 'Today'); }
public static function generate() { //@TODO: Implemet your own logic here $path = $_SERVER['DOCUMENT_ROOT']; $xmlDateFormat = "Y-m-d"; $changeFreq = "weekly"; $timeZoneInst = new DateTimeZone(CURRENT_TIMEZONE); $dateTime = new DateTime("now", $timeZoneInst); $sitemapGenInst = new Sitemap("http://" . $_SERVER['SERVER_NAME']); $sitemapGenInst->setPath($path . "/"); $dateTime->setTimestamp(time()); $sitemapGenInst->addItem('/', 1.0, $changeFreq, $dateTime->format($xmlDateFormat)); $dateTime->setTimestamp(time()); $sitemapGenInst->addItem('/contacts', 0.5, $changeFreq, $dateTime->format($xmlDateFormat)); $sitemapGenInst->createSitemapIndex("http://" . $_SERVER['SERVER_NAME'] . "/"); return true; }
function index() { $arrTmp = $this->product->findall(); $products = $arrTmp['rpta'] == true ? $arrTmp['array'] : array(); unlink(APPPATH . "../tmp/sitemap.xml"); unlink(APPPATH . "../tmp/sitemap-index.xml"); $sitemap = new Sitemap("https://www.lifeleg.com"); $sitemap->setPath('tmp/'); $sitemap->setFilename('sitemap'); ///AGREGAR ITEMS AL XML CON LAS RUTAS DE LAS PAGINAS WEB $sitemap->addItem('/', '1.0', 'daily', 'Today'); $hoy = getdate(); $sitemap->addItem('/index.php/Petshop', '0.8', 'weekly', $hoy['month'] . " " . $hoy['mday']); foreach ($products as $key => $value) { $sitemap->addItem('/index.php/Petshop/detail/' . $value['url'], '0.8', 'weekly', $hoy['month'] . " " . $hoy['mday']); } /// SE CREA EL ARCHIVO $sitemap->createSitemapIndex('https://www.lifeleg.com/tmp/', 'Today'); }
<?php include 'sitemap-php/Sitemap.php'; $sitemap = new Sitemap('http://www.wpstudiotw.com/test'); // $sitemap->startSitemap(); $sitemap->addItem('/', '1.0', 'daily', 'Today'); $sitemap->addItem('/about', '1.0', 'daily', 'Today'); $sitemap->setPath('sitemap/'); // $sitemap->setFilename('customsitemap'); $sitemap->createSitemapIndex('http://www.wpstudiotw.com/test/sitemap/', 'Today'); // $sitemap->endSitemap();
$sitemap->addItem(canonical($language_id, $language_code, $url->link('catalog/category', 'category_id=' . $category->category_id)), '0.9', 'daily', $category->date_modified); } } } // Generate product links $statement = $db->query('SELECT `product_id`, `date_modified` FROM `product` WHERE `status` = 1'); if ($statement->rowCount()) { foreach ($statement->fetchAll() as $product) { foreach ($languages as $language_id => $language_code) { $sitemap->addItem(canonical($language_id, $language_code, $url->link('catalog/product', 'product_id=' . $product->product_id)), '0.8', 'weekly', $product->date_modified); } } } // Generate tag links $statement = $db->query('SELECT `td`.`name`, (SELECT MAX(`p`.`date_modified`) FROM `product` AS `p` JOIN `product_to_tag` AS `p2t` ON (`p2t`.`product_id` = `p`.`product_id`) WHERE `p`.`status` = 1 AND `p2t`.`tag_id` = `td`.`tag_id`) AS `date_modified` FROM `tag_description` AS `td` HAVING `date_modified` IS NOT NULL'); if ($statement->rowCount()) { foreach ($statement->fetchAll() as $search) { foreach ($languages as $language_id => $language_code) { $sitemap->addItem(canonical($language_id, $language_code, $url->link('catalog/search', 'q=' . rawurlencode($search->name))), '0.7', 'weekly', $search->date_modified); } } } // Save sitemap $sitemap->createSitemapIndex(URL_BASE);
$changefreq = $val->validasi($_POST['changefreq'], 'xss'); $priority = $val->validasi($_POST['priority'], 'xss'); $tableset = new PoTable('setting'); $currentSet = $tableset->findBy(id_setting, '1'); $currentSet = $currentSet->current(); $website_url = $currentSet->website_url; $sitemap = new Sitemap($website_url); $sitemap->setPath('../../../'); $sitemap->addItem('/', $priority, $changefreq, $tgl_sekarang); $tablepages = new PoTable('pages'); $datapagess = $tablepages->findByDESC('active', 'Y', 'id_pages'); foreach ($datapagess as $datapages) { $sitemap->addItem('/pages/' . $datapages->seotitle, $priority, $changefreq, $datapages->date); } $tablecat = new PoTable('category'); $datacats = $tablecat->findByDESC('active', 'Y', 'id_category'); foreach ($datacats as $datacat) { $sitemap->addItem('/category/' . $datacat->seotitle, $priority, $changefreq, $tgl_sekarang); } $tablepost = new PoTable('post'); $dataposts = $tablepost->findByDESC('active', 'Y', 'id_post'); foreach ($dataposts as $dataposts) { $sitemap->addItem('/detailpost/' . $dataposts->seotitle, $priority, $changefreq, $dataposts->date); } $sitemap->createSitemapIndex($website_url, 'Today'); header('location:../../../sitemap.xml'); } else { header('location:../../404.php'); } } }
function generatePagesSitemap() { $sitemap = new Sitemap(SITE_DOMAIN); $sitemap->setPath(DOC_ROOT . '/'); $sitemap->setFilename('page'); $posts = new Posts(); $sitemap->addItem('', '1.0', 'daily', 'Today'); while ($row = $posts->getPostsLoop(null, 'page')) { $sitemap->addItem($posts->getPostPermLink($row['ID'], $row['post_type'], $row['link_title']), '0.8', 'weekly', $row['post_date']); } $sitemap->createSitemapIndex(SITE_DOMAIN, 'Today'); }
$charte = array("/charte/","/charte/qualite/","/charte/livraison/","/charte/services/","/charte/prix/","/charte/prix/","/charte/securite/","/charte/plus/","/charte/tailles/","/charte/cgv/","/charte/legal/","/charte/apropos/"); foreach ($charte as &$path) { $sitemap->addItem($path, '0.5', 'daily', 'Today'); echo "CHARTE : $path<br />\n"; } // AIDE $aide = array("/aide/","/aide/7___questions-generales.html","/aide/8___acheter.html","/aide/9___vendez-videz-vos-armoires.html","/aide/8__comment-ca-marche-.html","/aide/9__compte-client.html","/aide/10__programme-de-parrainage.html","/aide/11__contact.html","/aide/12__qualite-des-vetements.html","/aide/13__generalites.html","/aide/14__livraison.html","/aide/15__retour.html","/aide/16__generalites.html","/aide/17__que-puis-je-envoyer-.html","/aide/18__comment-etre-paye-.html","/aide/19__comment-encaisser-ses-gains-.html","/aide/20__assurance-retour.html","/aide/21__indemnisation.html","/aide/29_comment-puis-je-vendre-mes-vetements-a-roseindigo-.html","/aide/45_combien-darticles-puis-je-mettre-par-sac-.html","/aide/44_que-signifie-comme-neuf-.html","/aide/43_que-signifient-des-vetements-a-la-mode-.html","/aide/38_jhabite-en-region-parisienne-departements-75-92-93-ou-94-pourquoi-ne-puis-je-pas-commander-de-sac-.html","/aide/37_quadvient-il-des-vetements-non-repris-.html","/aide/36_puis-je-demander-le-retour-de-mes-vetements-.html","/aide/35_sous-combien-de-temps-mon-sac-va-t-il-etre-traite-.html","/aide/34_comment-vais-je-savoir-que-roseindigo-a-bien-receptionne-mon-sac-.html","/aide/33_comment-puis-je-trouver-le-point-mondial-relay-le-plus-proche-de-chez-moi-.html","/aide/32_dois-je-payer-pour-vous-adresser-mon-sac-de-vetements-.html","/aide/31_que-se-passe-t-il-une-fois-mon-sac-commande-.html","/aide/30_pourquoi-mon-sac-est-il-payant-.html","/aide/46_pourquoi-certains-articles-que-vous-nacceptez-pas-sont-disponibles-sur-le-site-.html","/aide/39_criteres-qualite-quelles-conditions-de-reprise-.html","/aide/40_quels-vetements-rachetez-vous-.html","/aide/41_quels-vetements-ne-sont-pas-repris-.html","/aide/42_quelles-marques-ne-sont-pas-rachetees-.html","/aide/47_pourquoi-ne-reprenez-vous-pas-les-articles-de-taille-6-mois-et-12-mois-.html","/aide/48_acceptez-vous-les-vetements-avec-une-etiquette-au-nom-de-mon-enfant-.html","/aide/58_marques-reprises.html","/aide/49_combien-vais-je-etre-paye-.html","/aide/50_comment-determinez-vous-la-valeur-de-mon-sac-.html","/aide/52_que-se-passe-t-il-si-je-conteste-la-valeur-de-reprise-de-mes-articles-.html","/aide/53_comment-beneficier-de-mes-gains-.html","/aide/54_dois-je-attendre-que-mes-vetements-soient-vendus-sur-le-site-de-roseindigo-pour-percevoir-mes-gains-.html","/aide/55_puis-je-utiliser-mes-gains-sur-roseindigocom-.html","/aide/56_si-je-choisis-de-recevoir-un-cheque-quand-vais-je-le-recevoir-.html","/aide/11_comment-sais-je-la-qualite-des-vetements-que-jachete-.html","/aide/12_que-signifie-bon-etat.html","/aide/13_que-signifie-neuf-avec-etiquette-.html","/aide/14_que-signifie-quun-article-nest-plus-disponible-.html","/aide/15_lorsquun-vetement-presente-une-etiquette-avec-plusieurs-tailles-laquelle-indiquez-vous-.html","/aide/16_a-quel-rythme-mettez-vous-des-nouveaux-articles-en-ligne-.html","/aide/19_est-ce-quun-article-mis-dans-mon-panier-mest-reserve-.html","/aide/22_puis-je-modifier-ou-annuler-une-commande-validee-.html","/aide/4_comment-fonctionnons-nous-.html","/aide/51_je-viens-de-connaitre-mon-gain-pourquoi-navez-vous-pas-rachete-tous-mes-vetements-.html","/aide/5_pourquoi-dois-je-creer-un-compte-client-.html","/aide/6_comment-puis-je-modifier-les-informations-de-mon-compte-.html","/aide/7_que-dois-je-faire-si-jai-oublie-mon-mot-de-passe-.html","/aide/8_que-dois-je-faire-si-je-souhaite-modifier-mon-mot-de-passe-.html","/aide/17_sous-quel-delai-vais-je-etre-livre-.html","/aide/18_quels-sont-vos-couts-de-livraison-.html","/aide/20_quest-ce-quun-article-cadeau-.html","/aide/21_que-se-passe-t-il-si-je-nai-pas-recu-ma-commande-.html","/aide/23_puis-je-etre-livree-en-dehors-de-la-france-.html","/aide/24_puis-je-retourner-un-article-qui-ne-me-convient-pas-.html","/aide/25_comment-proceder-pour-retourner-un-article-.html","/aide/26_dois-je-payer-les-frais-dexpedition-de-retour-.html","/aide/27_quand-et-comment-vais-je-recevoir-mon-remboursement-.html","/aide/28_sous-quels-delais-dois-je-vous-retourner-un-article-.html","/aide/10_comment-nous-contacter-.html","/aide/9_comment-fonctionne-le-programme-de-parrainage-.html","/aide/57_quest-ce-que-lassurance-retour-.html","/aide/59_que-se-passe-t-il-si-mon-sac-est-egare.html"); foreach ($aide as &$path) { $sitemap->addItem($path, '0.5', 'daily', 'Today'); echo "AIDE: $path<br />\n"; } $sitemap->createSitemapIndex('http://www.roseindigo.com/', 'Today');