Remository Plugin for Google Sitemap Generator Component

January 29th, 2007 by Marc

So after I completely relaunched icq-4u.com recently I was worried about google's ability of finding all my new pages on its own. Luckily there is a Mambo component called GSG (Google Sitemap Generator) which generates a google xml sitemap from all of the basic content. And because GSG allows enhancement with plugins, it is possible to add content from non-basic components such as Remository to the sitemap.

Note: Installation of GSG in Mambo seemed somewhat tricky at first. I had to copy the folders includes/domit and includes/patTemplate from a Joomla to my Mambo installation, but after that it worked fine!

I couldn't find a ready-to-download Remository plugin, so I made one myself. Please keep in mind that I do not have secret or non public folders in my Remository, so I do not check for these aspects when generating the links.

The following file should be called remository_map.class.php and copied to administrator/components/com_gsg/plugins/.

PHP:

  1. /**
  2. * Google Sitemap Generator.
  3. * @version SVN $Id$
  4. * @package gsg.org
  5. * @author Todd Nine*
  6. * @license Released under the terms of the GNU General Public License
  7. * @abstract This class represends the required methods of a 3PC Implementations.
  8. * Extend this class and override the method below.
  9. **/
  10. class remository_map extends GSGExtension{
  11.  
  12. /**
  13. * Get the URLS from the 3PC.
  14. * @return An array of URLResource objects.
  15. */
  16. function getURLResources() {
  17. global    $database,
  18. $mosConfig_live_site,
  19. $mosConfig_absolute_path,
  20. $gsg_url_changefreq,
  21. $gsg_url_priority;
  22.  
  23. $results = array ();
  24. $database->setQuery("SELECT id FROM mos_menu WHERE link = 'index.php?option=com_remository'");
  25. $Itemid = $database->loadResult();
  26.  
  27. $query = "SELECT f.* FROM mos_downloads_files AS f WHERE f.published=1 ORDER BY filetitle LIMIT 10";
  28.  
  29. $database->setQuery($query);
  30. $rows = $database->loadObjectList();
  31.  
  32. for ($i = 0, $n = count($rows); $i <$n; $i ++) {
  33. $row = & $rows[$i];
  34. $urlResource = new URLResource();
  35. $urlResource->title = 'Download Files: '. $row->filetitle;
  36. $urlResource->link = 'index.php?option=com_remository&Itemid='. $Itemid .'&func=fileinfo&id='. $row->id;
  37. $urlResource->date = gsg :: showdate(0, 0, 1);
  38. $urlResource->changeFreq = $gsg_url_changefreq;
  39. $urlResource->priority = $gsg_url_priority;
  40. $results[] = $urlResource;
  41.  
  42. }
  43.  
  44. // Getting the containers
  45. $query2 = "SELECT * FROM mos_downloads_containers ORDER BY sequence, name";
  46.  
  47. $database->setQuery($query2);
  48. $content_rows = $database->loadObjectList();
  49.  
  50. for ($i = 0, $n = count($content_rows); $i <$n; $i ++) {
  51. $row = & $content_rows[$i];
  52. $urlResource = new URLResource();
  53. $urlResource->title = 'Browse Files: '. $row->name;
  54. $urlResource->link = 'index.php?option=com_remository&Itemid='. $Itemid .'&func=select&id='. $row->id;
  55. $urlResource->date = gsg :: showdate(0, 0, 1);
  56. $urlResource->changeFreq = $gsg_url_changefreq;
  57. $urlResource->priority = $gsg_url_priority;
  58. $results[] = $urlResource;
  59. }
  60. return $results;
  61. }
  62.  
  63. /**
  64. * @return The string description
  65. */
  66. function getDescription() {
  67. return "Creates Remository sitemap.";
  68. }
  69.  
  70. }
  71. ?>

This will include nice Remository links in your GSG sitemaps it has been tested with Mambo 4.5.1 and Remository 3.41.

This will not make sef_ext-style links unless you modify certain GSG files. However, a workaround is possible which I could post if someone is interested.

Have fun!

Tags: , , , , , , , ,

Bookmark | del.icio.us | Digg it | Furl | RawSugar | Simpy | Spurl | Yahoo MyWeb

Posted in Mambo CMS, PHP |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.