A tumblelog CMS built on AJAX, PHP and MySQL.

sitemap.php 1.8KB

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