A tumblelog CMS built on AJAX, PHP and MySQL.

sitemap.php 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 = mysql_fetch_array($rs);
  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 = mysql_fetch_array($rs)) {
  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>