samedi 18 décembre 2010

Sitemap generator for phpBB 2.x

Increase the ranking and indexed pages of your phpBB 2 forum in Google, it's easy!
This code resolves your problems,
/************************************************************
************************************************************
**        Sami Maghrebi.
**        (C) sami-maghrebi.net 2008.
**        Sitemap generator for phpBB 2.x
**
*************************************************************
************************************************************/

$forum_url="http://#FORUM_URL#/"; //Insert here the forum url with root directory.

header("Content-type: application/xml");
include_once("config.php");
$link = mysql_connect($dbhost, $dbuser, $dbpasswd)  or die("Impossible de se connecter");
mysql_select_db($dbname) or die("Ne peut pas sélectionner la base de données");
$query1="SELECT * FROM `".$table_prefix."forums`";
$result1=mysql_query($query1) or die("Impossible de lire la table forums");

$date=date("Y-m-d");
$xmlscript="

xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">";

$xmlscript.="

" . $forum_url . "index.php
".$date."
daily
1
";

while($row = mysql_fetch_array($result1, MYSQL_NUM)){
$xmlscript.="

" . $forum_url . "viewforum.php?f=".$row[0]."
".$date."
daily
1
";
}

$query2="SELECT * FROM `".$table_prefix."topics`";
$result2=mysql_query($query2) or die("Can not read topics table");

while($row = mysql_fetch_array($result2, MYSQL_NUM)){
$xmlscript.="

" . $forum_url . "viewtopic.php?t=".$row[0]."
".date("Y-m-d",$row[4])."
daily
1
";
}

$xmlscript.="";
print($xmlscript);
In this line :[ $forum_url="http://#FORUM_URL#/";  ] insert your forum url.
Then insert this php file forum directory.
And now go to Google webmasters tools page, and add your site.
Go to SITEMAP tab (in the same page) and add your sitemap which must be the url of the script above.
Congratulation! Now you have a sitemap instantly updated.

Aucun commentaire:

Enregistrer un commentaire