is this possible?
Yes, if you manually cut and paste the text. There are no converters for TP and Wordpress.
This shouldn't be too difficult to write.
Here some code where I done it the other way around.
Remember to backup your databases before using this script.
P.S. I only wrote this script to see if is was possible. I kind of like to keep my options open ;).
<?php
// Converts tinyportal pages into wordpress pages
// Place this code in the wordpress folder
// REMOVE this script after use since it is a big SECURITY RISK
$PathToSMF = '../smf/'; // SET TO SMF LOCATION
require_once('wp-load.php'); // Wordpress
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Database access</title>
</head>
<body>';
// Look for Settings.php....
$PathToSMF = $PathToSMF.'Settings.php';
if (file_exists($PathToSMF))
{
// Found it!
require($PathToSMF);
}
else // Can't find it...
{
echo ' <p> Can\'t find SMF settings file:,',$PathToSMF,'</p><p></body></html>';
exit;
}
// Attempt a connection.
$attempt = @mysql_connect($db_server, $db_user, $db_passwd);
if ($attempt != false)
{
$attempt = @mysql_select_db($db_name);
}
else
{
echo ' <p> Can\'t connect to SMF database</p> ';
}
if ($attempt)
{
$attempt2 = @mysql_select_db(DB_NAME);
if ($attempt2 == false)
{
echo ' <p> Can\'t connect to wordpress database</p></p><p></body></html>';
exit;
}
// Insert a marker page. This also finds page id starting point
$now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s');
$post_guid = get_option('home') . '/?page_id=TinyPortal';
echo 'new id :',$post_guid,'<br>';
$user_id = 2;
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__(htmlspecialchars_decode($row[0])))."', '', 'Start of TinyPortal Pages', '0', '".$wpdb->escape(_c('tppage|wordpresspage'))."', '$now', '$now_gmt','$post_guid', 'publish', 'page', '', '', '')");
$NewPageID=$wpdb->insert_id;
$pagelist=array();
$pagename=array();
$subpage=array();
$attempt = @mysql_select_db($db_name);
if ($attempt == false)
{
echo ' <p> Can\'t connect to SMF database</p> ';
}
$request = @mysql_query("SELECT category, shortname FROM ${db_prefix}tp_articles");
// find data about pages so links can be converted...
$pagecount=0;
while ($row = @mysql_fetch_row($request))
{
$subpage[$pagecount] = $row[0];
$pagelist[$pagecount] = $NewPageID+$pagecount;
$pagename[$pagecount] = $row[1];
$pagecount++;
}
@mysql_free_result($request);
$request = @mysql_query("SELECT body, subject, category, shortname FROM ${db_prefix}tp_articles");
$oldIds=1;
$attempt2 = @mysql_select_db(DB_NAME);
while ($row = @mysql_fetch_row($request))
{
$oldIds++;
$NewPageID = $NewPageID+1;
echo ' - old ID -',$oldIds, ' - subject - ',$row[1],' - short name -',$row[3],' - new ID - ',$NewPageID,'</br>';
$pattern = '/\?page=.*"/';
$acount=preg_match_all($pattern, $row[0], $matches);
$acount=0;
foreach ($matches[0] as $thelink)
{
$linkstrlength=strlen($thelink)-1;
$oldlink = substr($thelink,6,-5);
// now search for replacment link id
$NewLinkID=-1;
// first look for name
for ($i = 0; $i < $pagecount; $i++)
{
if (strcmp($oldlink,$pagename[$i])==0)
{
$NewLinkID=$pagelist[$i]+1;
}
}
if ($NewLinkID==-1)
{
// else use id
for ($i = 0; $i < $pagecount; $i++)
{
if (($i+1)==intval($oldlink))
{
$NewLinkID=$pagelist[$i]+1;
}
}
}
if ($NewLinkID>-1)
{
$newlink = '?page_id=' . $NewLinkID. '"';
echo $acount,': ',$thelink,' ',$oldlink,' ',$newlink,'</br>';
$row[0] = str_replace($thelink,$newlink,$row[0]);
echo '<p>',$row[0],'</p>';
}
else
{
echo 'Link not found : ',$oldlink,'</br>';
}
$acount++;
}
$now = date('Y-m-d H:i:s');
$now_gmt = gmdate('Y-m-d H:i:s');
$post_guid = get_option('home') . '/?page_id='.$NewPageID;
echo 'new id :',$post_guid,'<br>';
$user_id = 2;
$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__(htmlspecialchars_decode($row[0])))."', '', '".$row[1]."', '0', '".$wpdb->escape(_c($row[3]))."', '$now', '$now_gmt','$post_guid', 'publish', 'page', '', '', '')");
echo 'Insert ID ',$wpdb->insert_id,'<br>';
echo '<hr>';
}
@mysql_free_result($request);
}
echo ' </body></html>';
?>
you run that in the databse ?
Thats a PHP file Crip. You probably run in it your browser from the root of your site.
Reckon it would work B0ss ?
Looking at the code a little closer it looks ok to me. But I was wrong in that, you need to place it in your wordpress folder. Then, make sure you change this line.
$PathToSMF = '../smf/'; // SET TO SMF LOCATION
If you're looking to try it, just make sure you have a backup of your stuff before you start changing stuff.
Yes this script should be placed in the Wordpress folder.
It’s just a quick hack I did to test if it was possible to transfer pages from one system to the other. And should not be used unless you know what you’re doing.
I would not recommend running this script on a live site. I tend to copy my websites over to an emulator, for example Server2go and test things out on this. It also serves as a backup to the live system.
I’ve done a little programming for both wordpress and smf and noticed that because of the coding style of the two applications the include files can be mixed to some degree. Hence, I thought I would try out a little test application.
With a bit of work you should be able to switch it around so that you can transfer Wordpress pages to TP. But saying that it may be quicker to do a cut and paste job of the web articles between the two systems
Note this script has only been tested on Wordpress 2.6.2 and Tinypportal 1.05 beta and 0.98.
TP + Wordpress --- both I do know, but myself was just curious .. good work PL
I know that is old topic, but i try to use script from PeterLawrence.
Can anyone explain to me why every time i get this error: "Can't find SMF settings file: /forum/Settings.php" ?
Patch to smf is correct.
WP is in mydomain.com
SMF is in mydomain.com/forum
so my patch to smf is: $PathToSMF = '/forum/';
or i messed up something.. ?
//
forgot to add:
WP: 3.1.2
SMF: 2.0 RC5
TP: 1.0 RC1 (old version)
adi1166,
Welcome to the TP Support Site.
Probably because of this ...
Quote from: PeterLawrence on October 10, 2008, 10:49:47 AM
Note this script has only been tested on Wordpress 2.6.2 and Tinypportal 1.05 beta and 0.98.
I doubt that anyone here is up to the task of upgrading it to work with the latest SMF and WP, let alone the latest TinyPortal.
ZarPrime
/forum is not what you want to use. If you look at this example he shows you what to use if your forum is in www.example.com/forum/. As Zar pointed out though, use this with caution and make backups before you do.
yes, i know that it's for old version WP, SMF and TP, but anyway i wanted to try it.
Script works, but doesn't insert entries from TP in WP tables :/
I guess i have to keep using TP :)