Skip to content
WJunction - Webmaster Forum

[IPB/vB/phpBB] TopicMap

Status
Not open for further replies.
IPB:

PHP:
<?php
// Index Site Topics (c) xSaimex[dot]com
// v0.1
// IPB Version

$host = ''; // e.g localhost
$user = ''; // e.g root
$pass = ''; // e.g 123
$db   = ''; // e.g forum

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT tid,title FROM topics")
or die(mysql_error());  

while($row = mysql_fetch_array($result)){

echo "<title>TopicMap</title>";
echo "<a href=\"index.php?showtopic=$row[tid]\"><b>$row[title]</b></a>";
echo "<br>";
}
?>
vBulletin:

PHP:
<?php
// Index Site Topics (c) xSaimex[dot]com
// v0.1
// vBulletin Version

$host = ''; // e.g localhost
$user = ''; // e.g root
$pass = ''; // e.g 123
$db   = ''; // e.g forum

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT threadid,title FROM thread")
or die(mysql_error());  

while($row = mysql_fetch_array($result)){

echo "<title>TopicMap</title>";
echo "<a href=\"showthread.php?t=$row[threadid]\"><b>$row[title]</b></a>";
echo "<br>";
}
?>
phpBB 3:

PHP:
<?php
// Index Site Topics (c) xSaimex[dot]com
// v0.1
// phpBB Version

$host = ''; // e.g localhost
$user = ''; // e.g root
$pass = ''; // e.g 123
$db   = ''; // e.g forum

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT topic_id,forum_id,topic_title FROM phpbb_topics")
or die(mysql_error());  

while($row = mysql_fetch_array($result)){

echo "<title>TopicMap</title>";
echo "<a href=\"viewtopic.php?f=$row[forum_id]&t=$row[topic_id]\"><b>$row[topic_title]</b></a>";
echo "<br>";
}
?>
Basically what it does, it creates a list of links from your forum in one page. I've yet to test how good it is with Google, but I'll work in making it search engine friendly later.

Demo:

Code:
http://xsaimex.com/topicmap.php
I've edited it for IPB/vB/phpBB 3, I have not yet tested it with phpBB 3, so if anyone runs a forum with phpBB 3, please test it if you can.

What you should know:

If your forums uses mysql table prefix. Change, ex:

PHP:
SELECT topic_id,forum_id,topic_title FROM phpbb_topics

to

SELECT topic_id,forum_id,topic_title FROM PREFIX_topics
Feel free to play around, and throw in some suggestions/ideas.
 

12 comments

MyBB Version

PHP:
<?php
// Index Site Topics (c) xSaimex[dot]com Modified for MyBB by pornreloaded[dot]org
// v0.1
// MyBB Version

$host = ''; // e.g localhost
$user = ''; // e.g root
$pass = ''; // e.g 123
$db   = ''; // e.g forum

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT tid,fid,subject FROM mybb_threads")
or die(mysql_error());  

while($row = mysql_fetch_array($result)){

echo "<title>TopicMap</title>";
echo "<a href=\"showthread.php?t=$row[tid]\"><b>$row[subject]</b></a>";
echo "<br>";
}
?>
 
r0ck, yeah it's cool.

Here is small update:

PHP:
<head>
<title>TopicMap</title>
</head>

<?php
// Index Site Topics (c) xSaimex[dot]com
// v0.2
// IPB Version

$host = 'localhost'; // e.g localhost
$user = ''; // e.g root
$pass = ''; // e.g 123
$db   = ''; // e.g forum
$URL  = "http://xsaimex.com/index.php?showtopic=";

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT tid,title FROM topics");
?>

<?php
while($row = mysql_fetch_array($result)){
?>

<td><a href="<?php echo $URL; ?><? echo $row[tid]; ?>" title="<? echo $row[title]; ?>" alt="Rapidshare Download"><strong><? echo $row[title]; ?></strong></a></td><br>

<?php
};
?>
I'm little tired so I'll document and make other versions tomorrow.
 
For phpBB2:

PHP:
<?php
# phpBB2 Topic Map
# Based on xSaimex mod
# Author: Whoo

$sitename = ''; //Name of your site
$host = '';  //MySQL host
$user = '';  // MySQL username
$pass = ''; // MySQL password
$db   = ''; // MySQL Database

mysql_connect("$host", "$user", "$pass") or die("Database connection could not be established.");
mysql_select_db("$db") or die("Database " . $db . " does not exist.");

$result = mysql_query("SELECT topic_id,forum_id,topic_title FROM phpbb_topics")
or die(mysql_error());  

while($row = mysql_fetch_array($result)){
    echo '<h1>' .$sitename. ' Topicmap</h1>';
    echo '<a href="viewtopic.php?f='.$row[forum_id].'&t='.$row[topic_id].'"><strong>'.$row[topic_title].'</strong></a>';
    echo '<br />';
}
?>
 
WCDDL (not tested!)
PHP:
<head>
<title>TopicMap for WCDDL</title>
</head>

<?php
$host = 'localhost'; // e.g localhost
$user = ''; // e.g root
$pass = ''; // e.g 123
$db   = ''; // e.g forum
$URL  = "/download.php?id=";

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());

$result = mysql_query("SELECT id,title FROM wcddl_downloads");
?>

<?php
while($row = mysql_fetch_array($result)){
?>

<td><a href="<?php echo $URL; ?><? echo $row['id']; ?>" title="<? echo $row['title']; ?>" alt="Rapidshare Download"><strong><? echo $row['title']; ?></strong></a></td><br>

<?php
};
?>
 
if your using Mybb with Google Seo:

PHP:
<?php
// Index Site Topics (c) xSaimex[dot]com Modified for MyBB by njoyddls[dot]com
// v0.2
// MyBB Version

$host = 'localhost'; // e.g localhost
$user = ''; // e.g root
$pass = ''; // e.g 123
$db   = ''; // e.g forum

mysql_connect("$host", "$user", "$pass") or die(mysql_error());
mysql_select_db("$db") or die(mysql_error());


$result = mysql_query("SELECT id,idtype,url FROM mybb_google_seo
WHERE idtype=4")
or die(mysql_error());  

while($row = mysql_fetch_array($result)){

echo "<title>TopicMap</title>";
echo "<a href=\"Thread-{$row['url']}\"><b>$row[url]</b></a>";
echo "<br>";
}
?>
 
Sorry I haven't updated, been really busy past few days. What I've got planned is adding pagination, so the sites with 20,000+ posts don't get overloaded. And also sorting by Category's perhaps.
 
Status
Not open for further replies.

About the author

S
Active Member · Joined
270
Messages
0
Reactions
16
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom