A tumblelog CMS built on AJAX, PHP and MySQL.

sitemap.php 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. // Code modified from the one at http://paste.ubuntu-nl.org/44548/
  13. header("Content-type: text/xml; charset=utf-8");
  14. require(dirname(__FILE__)."/config.php");
  15. include("classes/configuration.class.php");
  16. include("classes/gelato.class.php");
  17. $tumble = new gelato();
  18. $conf = new configuration();
  19. $isFeed = true;
  20. echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  21. $rs = $tumble->getPosts(1);
  22. ?>
  23. <!-- generator="gelato CMS" -->
  24. <urlset
  25. xmlns="http://www.google.com/schemas/sitemap/0.84"
  26. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  27. xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
  28. http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
  29. <url>
  30. <loc><?php echo $conf->urlGelato;?></loc>
  31. <priority>0.9</priority>
  32. <?php
  33. if ($tumble->contarRegistros()>0) {
  34. $register = mysql_fetch_array($rs);
  35. $formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
  36. echo "<lastmod>".$formatedDate."</lastmod>";
  37. }
  38. ?>
  39. <changefreq>hourly</changefreq>
  40. </url>
  41. <?php
  42. $rs = $tumble->getPosts($tumble->getPostsNumber());
  43. if ($tumble->contarRegistros()>0) {
  44. while($register = mysql_fetch_array($rs)) {
  45. $url = htmlspecialchars($conf->urlGelato."/index.php?post=".$register["id_post"]);
  46. $formatedDate = gmdate("Y-m-d", strtotime($register["date"]));
  47. ?>
  48. <url>
  49. <loc><?php echo $url;?></loc>
  50. <priority>0.7</priority>
  51. <lastmod><?php echo $formatedDate;?></lastmod>
  52. <changefreq>daily</changefreq>
  53. </url>
  54. <?php
  55. }
  56. }
  57. ?>
  58. </urlset>