Thangvip9x
02-21-2014, 11:00 PM
When you run sitemap.php, your sitemap will create
Please login host and create a file name sitemap.php and paste code
<?php
include('global.php');
$baseurl="http://yourdomain/";
$xml_thread = fopen("sitemap/sitemap_thread.xml", "w+");
$xml_forum = fopen("sitemap/sitemap_forum.xml", "w+");
$xml_user = fopen("sitemap/sitemap_user.xml", "w+");
$header_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
fwrite($xml_thread, $header_xml);
fwrite($xml_forum, $header_xml);
fwrite($xml_user, $header_xml);
// Create sitemap thread
$query=$db->query_read_slave("SELECT threadid,title,dateline FROM thread");
while($rows = $db->fetch_array($query)) {
fwrite($xml_thread, "<url>\n<loc>".$baseurl.fetch_seo_url('thread',array('threadid'=>$rows['threadid'], 'title'=>$rows['title']))."</loc>\n<lastmod>".date('c',$rows['dateline'])."</lastmod>\n<changefreq>yearly</changefreq>\n<priority>0.5</priority>\n</url>\n");
}
// Create sitemap forum
$query=$db->query_read_slave("SELECT forumid,title FROM forum");
while($rows = $db->fetch_array($query)) {
fwrite($xml_forum, "<url>\n<loc>".$baseurl.fetch_seo_url('forum',array('forumid'=>$rows['forumid'], 'title'=>$rows['title']))."</loc>\n<changefreq>yearly</changefreq>\n<priority>0.5</priority>\n</url>\n");
}
// Create sitemap user
$query=$db->query_read_slave("SELECT userid,username,joindate FROM user");
while($rows = $db->fetch_array($query)) {
fwrite($xml_user, "<url>\n<loc>".$baseurl.fetch_seo_url('member',array('userid'=>$rows['userid'], 'username'=>$rows['username']))."</loc>\n<lastmod>".date('c',$rows['joindate'])."</lastmod>\n<changefreq>yearly</changefreq>\n<priority>0.5</priority>\n</url>\n");
}
$footer_xml = "</urlset>";
fwrite($xml_thread,$footer_xml);
fwrite($xml_forum,$footer_xml);
fwrite($xml_user,$footer_xml);
fclose($xml_thread);
fclose($xml_forum);
fclose($xml_user);
?>
Create sitemap success<br>
Thread: <a href='sitemap/sitemap_thread.xml'>sitemap_thread.xml</a>
<br>
Forum: <a href='sitemap/sitemap_forum.xml'>sitemap_forum.xml</a>
<br>
User: <a href='sitemap/sitemap_user.xml'>sitemap_user.xml</a>
You can see sitemaps after run sitemap.php
yourdomain/sitemap/sitemap_thread.xml
yourdomain/sitemap/sitemap_forum.xml
yourdomain/sitemap/sitemap_user.xml
I don't like default sitemap from vbulletin
If you want auto create, you can add Cronjobs in host
Replace $baseurl="http://yourdomain/"; with your domain
Please Mark as Installed
Please login host and create a file name sitemap.php and paste code
<?php
include('global.php');
$baseurl="http://yourdomain/";
$xml_thread = fopen("sitemap/sitemap_thread.xml", "w+");
$xml_forum = fopen("sitemap/sitemap_forum.xml", "w+");
$xml_user = fopen("sitemap/sitemap_user.xml", "w+");
$header_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
fwrite($xml_thread, $header_xml);
fwrite($xml_forum, $header_xml);
fwrite($xml_user, $header_xml);
// Create sitemap thread
$query=$db->query_read_slave("SELECT threadid,title,dateline FROM thread");
while($rows = $db->fetch_array($query)) {
fwrite($xml_thread, "<url>\n<loc>".$baseurl.fetch_seo_url('thread',array('threadid'=>$rows['threadid'], 'title'=>$rows['title']))."</loc>\n<lastmod>".date('c',$rows['dateline'])."</lastmod>\n<changefreq>yearly</changefreq>\n<priority>0.5</priority>\n</url>\n");
}
// Create sitemap forum
$query=$db->query_read_slave("SELECT forumid,title FROM forum");
while($rows = $db->fetch_array($query)) {
fwrite($xml_forum, "<url>\n<loc>".$baseurl.fetch_seo_url('forum',array('forumid'=>$rows['forumid'], 'title'=>$rows['title']))."</loc>\n<changefreq>yearly</changefreq>\n<priority>0.5</priority>\n</url>\n");
}
// Create sitemap user
$query=$db->query_read_slave("SELECT userid,username,joindate FROM user");
while($rows = $db->fetch_array($query)) {
fwrite($xml_user, "<url>\n<loc>".$baseurl.fetch_seo_url('member',array('userid'=>$rows['userid'], 'username'=>$rows['username']))."</loc>\n<lastmod>".date('c',$rows['joindate'])."</lastmod>\n<changefreq>yearly</changefreq>\n<priority>0.5</priority>\n</url>\n");
}
$footer_xml = "</urlset>";
fwrite($xml_thread,$footer_xml);
fwrite($xml_forum,$footer_xml);
fwrite($xml_user,$footer_xml);
fclose($xml_thread);
fclose($xml_forum);
fclose($xml_user);
?>
Create sitemap success<br>
Thread: <a href='sitemap/sitemap_thread.xml'>sitemap_thread.xml</a>
<br>
Forum: <a href='sitemap/sitemap_forum.xml'>sitemap_forum.xml</a>
<br>
User: <a href='sitemap/sitemap_user.xml'>sitemap_user.xml</a>
You can see sitemaps after run sitemap.php
yourdomain/sitemap/sitemap_thread.xml
yourdomain/sitemap/sitemap_forum.xml
yourdomain/sitemap/sitemap_user.xml
I don't like default sitemap from vbulletin
If you want auto create, you can add Cronjobs in host
Replace $baseurl="http://yourdomain/"; with your domain
Please Mark as Installed