A tumblelog CMS built on AJAX, PHP and MySQL.

sitemap.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. if(!defined('entry')) define('entry',true);
  3. /* ===========================
  4. gelato CMS - A PHP based tumblelog CMS
  5. development version
  6. http://www.gelatocms.com/
  7. gelato CMS is a free software licensed under the GPL 2.0
  8. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  9. =========================== */
  10. ?>
  11. <?php
  12. require('entry.php');
  13. global $conf, $tumble, $db;
  14. // Code modified from the one at http://paste.ubuntu-nl.org/44548/
  15. header("Content-type: text/xml; charset=utf-8");
  16. $isFeed = true;
  17. echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  18. echo "<?xml-stylesheet type=\"text/xsl\" href=\"".$conf->urlGelato."/sitemap.xsl\"?>\n";
  19. $rs = $tumble->getPosts(1);
  20. ?>
  21. <!-- generator="gelato CMS" -->
  22. <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  23. <url>
  24. <loc><?php echo $conf->urlGelato;?></loc>
  25. <?php
  26. if ($db->contarRegistros()>0) {
  27. $register = mysql_fetch_array($rs);
  28. $formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
  29. echo "\n\t<lastmod>".$formatedDate."</lastmod>";
  30. }
  31. ?>
  32. <changefreq>hourly</changefreq>
  33. <priority>0.9</priority>
  34. </url>
  35. <?php
  36. $rs = $tumble->getPosts($tumble->getPostsNumber());
  37. if ($db->contarRegistros()>0) {
  38. while($register = mysql_fetch_array($rs)) {
  39. $url = $tumble->getPermalink($register["id_post"]);
  40. $formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
  41. ?>
  42. <url>
  43. <loc><?php echo $url;?></loc>
  44. <lastmod><?php echo $formatedDate;?></lastmod>
  45. <changefreq>daily</changefreq>
  46. <priority>0.7</priority>
  47. </url>
  48. <?php
  49. }
  50. }
  51. ?>
  52. </urlset>