Looking for Something? Search Afriwap now!!!
Add to Flipboard Magazine. | |

Sitemap for SMF (acceptable for Google Webmasters)

Author Topic: Sitemap for SMF (acceptable for Google Webmasters)  (Read 953 times)

0 Members and 1 Guest are viewing this topic.

Offline Timi Dapsin

  • Administrator
  • Hero Member
  • *****
  • Posts: 2,456
  • Today is that tomorrow you worried about yesterday
    • View Profile
Sitemap for SMF (acceptable for Google Webmasters)
« on: December 23, 2013, 02:09:08 PM »

Hi all,

A former mod of Sitemap for SMF does not get accepted by Google Webmasters Site when I want to submit it, because it has no acceptable file format for spiders to access. Its something like this http://yoursite.com/index.php?action=kitsitemap;xml

Now a coded a piece of PHP to create a sitemap containing boards and topic links only and acceptable by Google, just copy the below code and save as sitemap.php
Code: [Select]
Sitemap for SMF written by Timidapsin
$dbhost "";//your database host, usually "localhost" in many servers
$dbname "";// your SMF database name
$dbuser "";// your SMF database user or username
$dbpwd "";// your SMF database password
$siteurl "http://yoursite.com/";// your site URL with trailing slash (eg http://yoursite.com/)

//Connection to database done!
$connect mysql_connect($dbhost,$dbuser,$dbpwd)or die(mysql_error());
//I selected database name

//Configuring headers
header("Content-type: text/xml");
"<?xml version=1.0 encoding=UTF-8?>
echo'   <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">';

//querying for board ids in the database
$boards mysql_query("select * from smf_boards")or die(mysql_error());
$row mysql_fetch_array($boards))
$boardid $row['id_board'];



//querying for topic ids in the database
$topics mysql_query("select * from smf_topics")or die(mysql_error());
$row2 mysql_fetch_array($topics))
$topicid $row2['id_topic']; 



Edit the Mysql details and save
NOTE: If your table prefix is not smf_ please change it from the query
I don't know how to create SMF mod, I would have created a mod for it

Run http://yoursite.com/sitemap.php
Hope it helps! :)

« Last Edit: January 04, 2014, 12:48:25 AM by Timi Dapsin »


Other Topics To Read

Powered by EzPortal