CodeIgniter Forums
Sitemap generator - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Sitemap generator (/showthread.php?tid=32081)



Sitemap generator - El Forum - 07-12-2010

[eluser]cmarra[/eluser]
Hello everyone, I'm trying to use Sitemap Generator http://codeigniter.com/wiki/Google% 20Sitemaps /
everything works but I want to ensure that when the system enters a data in the database then I should rebuild the sitemap ...

I would like to make this controller without cron script ...

any ideas?


Sitemap generator - El Forum - 07-12-2010

[eluser]wingdspur[/eluser]
Make sure that the page db table you are using has a last_modified field and when ever a user adds a new page or updates a page, have it call the sitemap controller method to generate a new sitemap.xml in the background. So inside the controller method for adding/updating pages, just call the sitemap controller method that generates the new XML every time there is a new page added or an update to an existing page and make sure you are updating the last_modified timestamp field as well so that the sitemap that gets generated has an updated last_modified tag in the xml file.


Sitemap generator - El Forum - 07-12-2010

[eluser]cmarra[/eluser]
ok but you can call a controller in another controller? if you like?


Sitemap generator - El Forum - 07-12-2010

[eluser]wingdspur[/eluser]
Well you could just move the sitemap controller method into the same controller as your page controller and then do $this->sitemap();


Sitemap generator - El Forum - 07-12-2010

[eluser]cmarra[/eluser]
ok tnx 1000 Wink


Sitemap generator - El Forum - 07-12-2010

[eluser]InsiteFX[/eluser]
Create a MY_Controller

Then extend your controllers from the MY_Controller
this way you can add your site_map code to the MY_Controller
and it will be avaible to all your controllers and the whole
application.

InsiteFX