<?php
//identify host and its directory, if any
require_once ('tiki-setup.php');
include_once ('lib/articles/artlib.php');
global $smarty, $tikilib;
$foo = parse_url($_SERVER["REQUEST_URI"]);
$parts = explode('/', $foo['path']);
if (count($parts) > 1) unset ($parts[count($parts) - 1]);
$mail_machine_raw = $tikilib->httpPrefix( true ) . implode('/', $parts) . '/';
header("Content-type: text/xml");
//connect to database
require 'type you location of local.php here';
$connectionId = mysql_connect($host_tiki, $user_tiki, $pass_tiki) or die("Could not connect to host.");
mysql_select_db($dbs_tiki, $connectionId) or die("Could not find database.");
//connect to the table tiki_articles
$query = "SELECT * FROM tiki_articles ORDER BY created DESC";
$resultID = mysql_query($query, $connectionId) or die("Data not found.");
//xml
$xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; //start create xml
$xml_output .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<url>\n";
if ($row['publishDate'] > $row['created']) {
$lastmod=$row['publishDate'];
} else {
$lastmod=$row['created'];
}
include_once('tiki-sefurl.php');
$article = $mail_machine_raw . filter_out_sefurl('tiki-read_article.php?articleId=' . $row['articleId'], $smarty, 'article', $row['title']);
$xml_output .= "\t\t<loc>" . $article . "</loc>\n"; //identify url location
$xml_output .= "\t\t<lastmod>" . gmdate("Y-m-d",$lastmod) . "</lastmod>\n"; //identify last modification
$xml_output .= "\t\t<changefreq>" . "daily" . "</changefreq>\n";
$xml_output .= "\t</url>\n";
}
$xml_output .= "</urlset>";
echo $xml_output;
?>
Save the above scripts to sitemap1.php. If you have already registered your website to Google, Yahoo, and Bing, then you can add to subscribe the sitemap1.php to them.
Link does not appear well.
ReplyDeletehttp://www.portal-spiritual.eu/tiki-read_article.php?articleId=182-article&
2015-03-20
daily
http://www.portal-spiritual.eu/