Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Simple SiteMap...

goxonlinegoxonline New
edited May 2007 in Vanilla 1.0 Help
I make this like php script to build a site map, if no an add-on, but works!, request "User friendly URLs" and chage the line with your url.: "http://www.have-a-life.com/forum/discussion/$row[DiscussionID]" :) File name: sitemap.php <?php /** Simple Site map generator, base on the protocol site in http://www.sitemap.org for Vanilla. **/ //Database connection. function GetConnet() { if (!($link=mysql_connect("localhost","username","database_password"))) { echo "Error conecting to the data base."; exit(); } if (!mysql_select_db("database",$link)) { echo "Error selecting the bata base."; exit(); } return $link; } $link=GetConnet(); //Build site map: print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\r"; print "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; $result=mysql_query("SELECT DiscussionID, DateLastActive FROM LUM_Discussion WHERE Closed = '0' ORDER BY DiscussionID DESC",$link); while($row = mysql_fetch_array($result)) { printf(" <url> <loc>http://www.have-a-life.com/forum/discussion/$row[DiscussionID]</loc> <lastmod>$row[DateLastActive]</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url>"); } print "\n\r</urlset>"; mysql_free_result($result); mysql_close($link); ?>

Comments

  • New code, time fixed... <?php /** Simple Site map generator, base on the protocol site in http://www.sitemap.org . Create by Gonzalo Rodriguez (http://www.gxnetwork.net) for the vanilla project http://www.lussumo.com . This is free, and GPL. **/ //Database connection. function GetConnet() { if (!($link=mysql_connect("localhost","username","database_password"))) { echo "Error conecting to the data base."; exit(); } if (!mysql_select_db("database",$link)) { echo "Error selecting the bata base."; exit(); } return $link; } $link=GetConnet(); //Build site map: print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\r"; print "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; $result=mysql_query("SELECT DiscussionID, YEAR(DateLastActive) AS year, MONTH(DateLastActive) AS month, DAY(DateLastActive) AS day FROM LUM_Discussion WHERE while($row = mysql_fetch_array($result)) { print " <url> <loc>http://www.have-a-life.com/forum/discussion/$row[DiscussionID]</loc> <lastmod>$row[year]-$row[month]-$row[day]</lastmod> <changefreq>daily</changefreq> <priority>0.5</priority> </url>"; } print "\n\r</urlset>"; mysql_free_result($result); mysql_close($link); ?>
This discussion has been closed.