本文整理汇总了PHP中Sitemap::setDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP Sitemap::setDomain方法的具体用法?PHP Sitemap::setDomain怎么用?PHP Sitemap::setDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sitemap
的用法示例。
在下文中一共展示了Sitemap::setDomain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sitmap
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'));
}