A tumblelog CMS built on AJAX, PHP and MySQL.

sitemap.php 1.7KB

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