My Research -> WordPress to LifeType migration.

My Research -> WordPress to LifeType migration.

Postby bet0x on Fri Nov 16, 2007 5:37 pm

First of all, my english its like your martian ^^ but you will get what i want to say.

My first attempt to migrato from WP to LT was a mess, then i start to research from scratch.

1.- Migratin categories [simple script]

Code: Select all
<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("db", $con);

$result = mysql_query("SELECT * FROM wp_terms");

while($row = mysql_fetch_array($result))
  {
?>
<PRE>
INSERT INTO `lt_articles_categories` VALUES (<?=$row['term_id'];?>, '<?=$row['name'];?>', '', 1, '<?=date("Y-m-d h:i:$row[term_id]");?>', 1, 0, '<?=strtolower($row['name']);?>', '', '<?=$row['slug'];?>', 0, 0);
</PRE>
<?php
  }

mysql_close($con);
?>


This generate a SQL script with the categories from WP ready to insert on the LifeType DB, its was prepared to be "user-categories" and not as general categories.

Then you can at least import the WP categories for now. Im researching now the post thing :) then when i finish some "core" coder of LT can make a "migration wizard" to LT ;).

My blog with the migrated categories: http://www.barrahome.org
bet0x
 
Posts: 5
Joined: Fri Nov 16, 2007 5:14 pm
Location: Rosario, Santa Fe

Postby phunkphorce on Fri Nov 16, 2007 7:06 pm

You should really use the API in order to get data inserted into the database. So instead of building the SQL query yourself, why don't you let LT do it for you?

1) Create an ArticleCategory object
2) Call ArticleCategories::addArticleCategory
3) and you're done

Behind the scenes, LT will take care of setting some additional needed values for some fields not just in the lt_articles_categories table, but also in other tables.

You obviously need to be a bit familiar with object-oriented programming, but otherwise we're not going to accept code that accesses the database directly.
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby bet0x on Fri Nov 16, 2007 9:05 pm

phunkphorce wrote:You should really use the API in order to get data inserted into the database. So instead of building the SQL query yourself, why don't you let LT do it for you?

1) Create an ArticleCategory object
2) Call ArticleCategories::addArticleCategory
3) and you're done

Behind the scenes, LT will take care of setting some additional needed values for some fields not just in the lt_articles_categories table, but also in other tables.

You obviously need to be a bit familiar with object-oriented programming, but otherwise we're not going to accept code that accesses the database directly.


My idea is not wrote the whole thing, that is why i marked it as "Reserch" also sorry for post in the wrong section, but i will try do my best.

Also thanks for the tips :) and the good welcome :P
bet0x was here ^^
bet0x
 
Posts: 5
Joined: Fri Nov 16, 2007 5:14 pm
Location: Rosario, Santa Fe


Return to Plugin Development Team

cron