Fabrik and JSitemap

A way to make a sitemap of all your records in a table is by using this file.php:

$mysqli = new mysqli("localhost", "root", "", "testdb");
$result=$mysqli->query("SELECT * FROM yourtable");

$xml=new DOMDocument("1.0");
$xml->formatOutput=true;
$urlset=$xml->createElement('urlset');
$urlset->setAttribute('xmlns', "http://www.google.com/schemas/sitemap/0.84");
$urlset->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
$urlset->setAttribute('xsi:schemaLocation', "http://www.google.com/schemas/sitemap/0.84/sitemap.xsd");

$xml->appendChild($urlset);

while($row=mysqli_fetch_array($result)){
$url=$xml->createElement("url");
$urlset->appendChild($url);

$loc=$xml->createElement("loc", "https://yoursite.com/index.php/yourtable/details/99/".$row['id']);
$url->appendChild($loc);

$lastmod=$xml->createElement("lastmod",$row['date_time']);
$url->appendChild($lastmod);

$changefreq=$xml->createElement("changefreq",'weekly');
$url->appendChild($changefreq);

$priority=$xml->createElement("priority",'0.8');
$url->appendChild($priority);
}

echo "<xmp>".$xml->saveXML()."</xmp>";

$xml->save("reports.xml");
 
Hi,

i bring this up again and I wonder if there is someone who used it and had success.
Thanks.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top