Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Movable Type Import 0.4
This has been tried successfully on a couple different MT databases, but has had no exhaustive testing. It would therefore be ill-advised to run this on anything other than a clean new Txp install.
To run the import, open the script in a text editor and fill in database connection values for both the MT database (to export from) and the current Txp database (to import into). They may of course be the same.
Put the script in your /textpattern/ directory and load it in a browser at
yoursite/textpattern/txp_mt_import_04.php
You should see instant feedback on the authors, articles and comments imported.
If something goes wrong, see you back here.
text*
Offline
Re: Movable Type Import 0.4
It seems to have worked well! I have one problem.
I did do the import on a fresh install – so the comment links should have been working just fine.
The <txp:comments_invite /> tag creates results like this:
<a href=”/article/382/#comment”></a> [4]
Could the import have mangled this somehow?
Offline
Re: Movable Type Import 0.4
Ah, it’s because there’s no ‘comment invite’ in the article records.
I’ll fix it, but in the meantime you can run the following sql:
update textpattern set AnnotateInvite = 'Comments';
(change ‘Comments’ to whatever you like [but keep the ‘quotes’]).
text*
Offline
Re: Movable Type Import 0.4
Thank you very much!
Offline
Re: Movable Type Import 0.4
One last thing: if you refine this further, will there be a way to import categories?
Offline
Re: Movable Type Import 0.4
I have several MT weblogs sharing a database, is there a way to restrict this to importing from one blog_id ?
Offline
Re: Movable Type Import 0.4
…added category import in 0.2
…added blog_id filtering in 0.3
text*
Offline
Re: Movable Type Import 0.4
2 things –
Would it be possible to import entries with categories intact on each post?
Also, it looks as though the import brought all the comments on my MT install – about 600 of them belong to my girlfriends blog. Is it possible to set the comment import to only grab them for the entries it’s importing?
Offline
Re: Movable Type Import 0.4
Worked great.
I did want to mention that while selecting by blog_id imported the entries from just that blog, it imported the categories and comments from all the blogs.
Oh yeah,what eVilosity said. It would be great to have the import keep the assigned categories intact.
Offline
Re: Movable Type Import 0.4
> It would be great to have the import keep the assigned categories intact.
I AM TRYING TO MAKE DINNER
:-)
I thought they did – I see now it looks like all the MT mysql dumps I’ve received have an entry_category_id of NULL for every single article. Is there something about the categorisation schema I’m not seeing?
text*
Offline
Re: Movable Type Import 0.4
Sorry man – in my time zone dinner was ages ago evil grin
Offline
Re: Movable Type Import 0.4
Dinner? Next thing we know you’ll be telling us you have a living to make.
The nerve of some people.
Offline
Re: Movable Type Import 0.4
Heh. And you thought you were going to have a life with us nagging at you for every little thing? :)
Offline
Re: Movable Type Import 0.4
…added comments blog_id filtering in 0.4
(For some reason no category info is making it into the MT mysqldumps I’ve received – someone want to send me a MT-export file?)
text*
Offline
Re: Movable Type Import 0.4
Dean, the category information is stored in a table called ‘mt_placement’.
<code>
#Table structure for table `mt_placement`
CREATE TABLE `mt_placement` (
`placement_id` int(11) NOT NULL auto_increment,
`placement_entry_id` int(11) NOT NULL default ‘0’,
`placement_blog_id` int(11) NOT NULL default ‘0’,
`placement_category_id` int(11) NOT NULL default ‘0’,
`placement_is_primary` tinyint(4) NOT NULL default ‘0’,
PRIMARY KEY (`placement_id`),
KEY `placement_entry_id` (`placement_entry_id`),
KEY `placement_category_id` (`placement_category_id`),
KEY `placement_is_primary` (`placement_is_primary`)
) TYPE=MyISAM;
#Dumping data for table `mt_placement`
INSERT INTO `mt_placement` VALUES (1, 1, 1, 1, 1);
INSERT INTO `mt_placement` VALUES (2, 2, 1, 2, 1);
</code>
- – - – -
<code>
Changing the article query to
select
mt_entry.entry_id as ID,
mt_entry.entry_text as Body,
mt_entry.entry_text_more as Body2,
mt_entry.entry_title as Title,
mt_entry.entry_created_on as Posted,
mt_entry.entry_modified_on as LastMod,
mt_category.category_label as Category1,
mt_author.author_name as AuthorID
from mt_entry
left join mt_author on
mt_author.author_id = mt_entry.entry_author_id
left join mt_placement on
mt_placement.placement_entry_id = mt_entry.entry_id
left join mt_category on
mt_category.category_id = mt_placement.placement_category_id
where entry_blog_id = ‘$blog_id’
</code>
worked great for me, however this could potentially cause problems if people have multiple categories assigned to one post (ie, then placement_is_primary=0).
Last edited by froehle (2004-02-29 20:54:14)
Offline