![]() |
|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
IP: 112.84.243.90
|
|||
|
|||
|
1. 文章标题等基本数据导入
织梦CMS的文章标题、正文和栏目分别存放在三个不同的表上,但WordPress把文章标题和正文放在一个表上,栏目放在另外一个表上。为了简化后面的工作,第一步我首先把织梦的全站RSS文件(rss.php)保存下来,然后使用WordPress自带的RSS导入该文件。这样就可以使WordPress在wp_posts上生成文章标题,在dede_terms上生成文章目录,并匹配起来。通过RSS导入,wp_posts上还导入了文章的摘要、日期、自定义网址等数据。但RSS导入不会导入全文。 2. 文章全文导入 织梦数据库的文章全文储存在dede_addonarticle表上的body里,我们要把这个body的内容转到Worpress数据库里wp_posts表上的post_content里。这个转换,需要使用一个桥梁——那就是dede_archives,即dede_addonarticle上body的内容先转到dede_archives上,再从dede_archives上再转到wp_posts上的post_content里。这两次转换的匹配点,分别是织梦里的文章id,以及Wordpress里已经导入了的文章标题(这与织梦里的文章标题是一样的)。具体步骤如下: 导放文章标题到wordpress: Code:
insert into wp_posts(post_title) select title from dede_archives; Code:
UPDATE dede_archives, dede_addonarticle SET dede_archives.body = dede_addonarticle.body WHERE dede_archives.id = dede_addonarticle.aid 接下来把整个dede_archives表导入到WordPress的数据库上,使其与wp_posts同在一个数据库下。 再次使用UPDATE命令把,把dede_archives上的body导入到wp_posts上的post_content上,以文章标题为匹配点 (前提是,你的文章标题都是唯一的): Code:
UPDATE wp_posts,dede_archives SET wp_posts.post_content= dede_archives.body WHERE wp_posts.post_title = dede_archives.title 在WordPress上安装一个叫Simple Hit Counter的Plug-in,这样数据库里就出现一个叫wp_hitcount的表。 在wp_posts增加一个叫hits的column,然后把dede_archives上的点击数click导入到wp_posts的hits上,仍然以标题为匹配点。 最后把wp_posts的hits导入到wp_hitcount的hits上,这次以wp_posts的ID和wp_hitcount的pid为匹配点。 有时要将2页内容合并,可以用: Code:
update wp_posts,dede_archives set wp_posts.post_content=CONCAT(wp_posts.post_content,dede_archives.body) WHERE wp_posts.post_title = dede_archives.title Last edited by topvip : 2012-07-17 at 02:17 AM |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|