本文整理汇总了PHP中Sitemap::addItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Sitemap::addItem方法的具体用法?PHP Sitemap::addItem怎么用?PHP Sitemap::addItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sitemap
的用法示例。
在下文中一共展示了Sitemap::addItem方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createXMLSiteMap
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');
}
示例2: 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'));
}
示例3: generate
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;
}
示例4: index
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');
}
示例5: Sitemap
<?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();
示例6: Url
$response->addHeader('Content-Type: text/html; charset=utf-8');
$response->setCompression(GZIP_COMPRESSION_LEVEL);
// Init URL
$url = new Url($db, $request, $response, URL_BASE);
// Init sitemap
$sitemap = new Sitemap(URL_BASE);
$sitemap->setPath(DIR_BASE . DIR_SEPARATOR . 'public' . DIR_SEPARATOR);
// Get alt languages
$statement = $db->query('SELECT * FROM `language`');
$languages = array();
foreach ($statement->fetchAll() as $language) {
$languages[$language->language_id] = $language->code;
}
// Add information Pages
foreach ($languages as $language_id => $language_code) {
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/about')), '1.0', 'monthly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/team')), '1.0', 'monthly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/terms')), '1.0', 'monthly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/licenses')), '1.0', 'monthly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/faq')), '1.0', 'monthly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/bitcoin')), '1.0', 'monthly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/information/promo')), '1.0', 'monthly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('common/contact')), '1.0', 'yearly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('account/account/login')), '1.0', 'yearly');
$sitemap->addItem(canonical($language_id, $language_code, $url->link('account/account/create')), '1.0', 'yearly');
}
// Generate categories
$statement = $db->query('SELECT `c`.`category_id`,
(SELECT MAX(`p`.`date_modified`) FROM `product` AS `p` WHERE `p`.`category_id` = `c`.`category_id` AND `p`.`status` = 1) AS `date_modified`
FROM `category` AS `c`
HAVING `date_modified` IS NOT NULL');
示例7: header
header('location:../../admin.php?mod=' . $mod);
} else {
header('location:../../404.php');
}
} elseif ($mod == 'setting' and $act == 'sitemap') {
if ($currentRoleAccess->modify_access == "Y") {
include_once 'sitemap.php';
$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);
}
示例8: generatePagesSitemap
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');
}
示例9: WHERE
# DEFINE PRIORITY VARIABLES
define("HOMEPAGE_PRIORITY", "1.0");
define("DEPARTMENT_PRIORITY", "0.9");
define("PRODUCT_PRIORITY", "0.7");
define("CONTENT_PRIORITY", "0.7");
define("OTHER_PRIORITY", "0.5");
# 0.5 IS A DEFAULT VALUE
#DEFINE CHANGEFREQUENCY VARIABLE
define("HOMEPAGE_CHANGEFREQ", "hourly");
define("DEPARTMENT_CHANGEFREQ", "weekly");
define("PRODUCT_CHANGEFREQ", "weekly");
define("CONTENT_CHANGEFREQ", "weekly");
define("OTHER_CHANGEFREQ", "weekly");
define("SITEMAP_CHANGEFREQ", "daily");
# ADD THE HOMEPAGE WITH A SLASH "/"
$s->addItem(SITE_URL, '', HOMEPAGE_CHANGEFREQ, HOMEPAGE_PRIORITY);
#======================== PRODUCTS LINKS=====================
# GETTING PRODUCTS FROM DATABASE
$obDatabase->query = " SELECT distinct vTitle,vSeoTitle,iProdid_PK,tmBuildDate,tmEditDate FROM " . PRODUCTS . " P, " . FUSIONS . " F " . " WHERE (P.iProdid_PK=F.iSubId_FK " . " AND vtype='product' " . " AND iState=1) ORDER BY tmBuildDate";
$prodRows = $obDatabase->fetchQuery();
$prodRowsRecord = $obDatabase->record_count;
#CHECK IF PRODUCT EXISTS
if ($prodRowsRecord > 0) {
#LOOP THROUGH ALL RECORDS
for ($i = 0; $i < $prodRowsRecord; $i++) {
$lastmod = "";
if ($prodRows[$i]->tmEditDate > 0) {
$lastmod = $s->searchEngineDateFormat($prodRows[$i]->tmEditDate);
} else {
$lastmod = $s->searchEngineDateFormat($prodRows[$i]->tmBuildDate);
}
示例10: Sitemap
require_once '../include/ticket_db.php';
include '../include/error.php';
require_once 'DbUtils.php';
require_once 'Utils.php';
// create the Sitemap object
$s = new Sitemap();
# make mainpage url
# get all categories
# create category urls
# get all events
# create event urls
#
// add sitemap items
# YYYY-MM-DD
$dt = date("Y-m-d");
$s->addItem($root_url . '/', $dt, 'weekly', '1.0');
$s->addItem($root_url . '/Sports-Tickets.html', $dt, 'weekly', '0.75');
$s->addItem($root_url . '/Concert-Tickets.html', $dt, 'weekly', '0.75');
$s->addItem($root_url . '/Theater-Tickets.html', $dt, 'weekly', '0.75');
if ($dbh = mysql_connect($host_name, $db_username, $db_password)) {
mysql_select_db($db_name);
$categoryIDList = GetAllSubordinatesOfCategory('ModifiedPreorderTreeTraversalCategories', 0);
if (is_array($categoryIDList)) {
foreach ($categoryIDList as $categoryIDArray) {
$url = make_category_url($categoryIDArray['name'], $categoryIDArray['id']);
$s->addItem($url, $dt, 'weekly', '0.75');
}
} else {
echo "Database error!";
}
$bsql = "SELECT EventName, EventID FROM `Events` WHERE CategoryID<>1310 AND CategoryID<>1111";
示例11: Sitemap
<?
include 'Sitemap.php';
include '../config/settings.inc.php';
$sitemap = new Sitemap('http://www.roseindigo.com');
$sitemap->setPath('maps/');
// $sitemap->addItem('/filles/naissance', '1.0', 'daily', 'Today');
$sitemap->setFilename('categories');
// VENDEZ
$sitemap->addItem("/vendez", '0.5', 'daily', 'Today');
$sitemap->addItem("/concept", '0.5', 'daily', 'Today');
$sitemap->addItem("/livre-d-or", '0.5', 'daily', 'Today');
// MARQUES
$servername = _DB_SERVER_;
$username = _DB_USER_;
$password = _DB_PASSWD_;
// Create connection
$conn = new mysqli($servername, $username, $password);
$conn->select_db("presta");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// print_r( "Connected successfully !!!!<br/>");
// print_r($conn);
示例12: Sitemap
require_once '../include/new_urls/ticket_db.php';
include_once '../include/error.php';
require_once 'DbUtils.new_urls.php';
require_once 'Utils.php';
// create the Sitemap object
$s = new Sitemap();
# make mainpage url
# get all categories
# create category urls
# get all events
# create event urls
#
// add sitemap items
# YYYY-MM-DD
$dt = date("Y-m-d");
$s->addItem($root_url . '/', $dt, 'weekly', '1.0');
# $s->addItem($root_url . '/sports/', $dt, 'weekly', '0.75');
# $s->addItem($root_url . '/concert/', $dt, 'weekly', '0.75');
# $s->addItem($root_url . '/theater/', $dt, 'weekly', '0.75');
if ($dbh = mysql_connect($host_name, $db_username, $db_password)) {
mysql_select_db($db_name);
$categoryIDList = GetAllSubordinatesOfCategory('ModifiedPreorderTreeTraversalCategories', 0);
if (is_array($categoryIDList)) {
foreach ($categoryIDList as $categoryIDArray) {
$url = make_category_url($categoryIDArray['name']);
$s->addItem($url, $dt, 'weekly', '0.75');
}
} else {
echo "Database error!";
}
$bsql = "SELECT EventName, EventID, CategoryID FROM `Events` WHERE CategoryID<>1310 AND CategoryID<>1111";
示例13: while
$result->close();
}
echo "<br/>";
$sql = "SELECT * FROM ps_product LIMIT 0 , 50000 ";
//SELECT ps_product.* FROM LEFT JOIN ps_stock_available on WHERE ps_stock_available.quantity IS NO NULL
print_r($sql);
echo "<br/>";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
// 89946746
// $sql_quantity = "SELECT `quantity` FROM `ps_stock_available` WHERE `id_product` LIKE ".$row["id_product"];
// $result_quantity = $conn->query($sql);
// print_r($result_quantity);
$product_url = "/unecategorie/" . $row["id_product"]. "-nomduproduit.html";
$sitemap->addItem($product_url, '0.5', 'daily', 'Today');
}
} else {
echo "0 results<br/>";
}
$conn->close();
$sitemap->createSitemapIndex('http://www.roseindigo.com/', 'Today');