Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-11-15 04:57:23

jim
Member
Registered: 2008-11-06
Posts: 29

Import Question

Hi folks,

I’m trying to import posts from a home-grown blogging platform to TXP. These posts already contain well-formed HTML. I’m creating an mtimport (Movable Type Import Format) file to do the move. It seems to work, although TXP tries to apply Textile formatting to my imported posts, resulting in some extraneous tags. For example, a BLOCKQUOTE block ends up with P tags around it, and it wreaks havoc with meaningless line breaks in general.

Under Preferences, I tried changing “Use Textile” to “leave text untouched”, and then ran the import again, but I got the same results.

Any suggestions for how to suppress this behavior?

Thanks!

Jim

Offline

#2 2008-11-15 14:58:32

jim
Member
Registered: 2008-11-06
Posts: 29

Re: Import Question

I shouldn’t post so late! The answer was obvious in the cold light of day: add CONVERT BREAKS: 0 to each mtimport entry.

Also, a tip for anybody who Googles this forum later: you need to open and close the body with five dashes, or TXP will not import the body.

So, this is wrong, and TXP will import everything but the body:

--------
TITLE: Sample Post
AUTHOR: jim
DATE: 01/31/2002 03:31:05 PM
PRIMARY CATEGORY: Main
STATUS: publish
ALLOW COMMENTS: 1
CONVERT BREAKS: 0
-----
BODY:
This is the body.
--------
TITLE: Second Post
etc.

This is right:

--------
TITLE: Sample Post
AUTHOR: jim
DATE: 01/31/2002 03:31:05 PM
PRIMARY CATEGORY: Main
STATUS: publish
ALLOW COMMENTS: 1
CONVERT BREAKS: 0
-----
BODY:
This is the body.
-----
--------
TITLE: Second Post
etc.

TXP still throws an error for each post imported:

Notice: Array to string conversion in /f1/content/jim/public/textpattern/include/import/import_mt.php on line 192

… but the import seems to work in spite of this.

Take care,

Jim

Offline

#3 2008-11-15 15:03:02

jim
Member
Registered: 2008-11-06
Posts: 29

Re: Import Question

I shouldn’t post so late! The answer was obvious in the cold light of day: add CONVERT BREAKS: 0 to each mtimport entry.

Crap, that isn’t quite right either. I’ll post back if I find a solution.

Offline

#4 2008-11-15 17:01:26

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

Re: Import Question

Jim,

Thanks for reports. I’ve never imported from another CMS yet – but I have one coming up soon.
This post might come in handy.

Thx.

Offline

#5 2008-11-15 18:04:05

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Import Question

Offline

#6 2008-11-15 19:00:12

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: Import Question

Also, when you’re done, if you have any tips you could share with us (even though it’s a home-grown CMS, some of the tips might well be useful to others importing from stock MT installs) then please either post here, shoot me an e-mail or grab a wiki account and add them to the Import page (and/or the specific Movable Type page). Cheers!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Online

#7 2008-11-18 04:11:40

jim
Member
Registered: 2008-11-06
Posts: 29

Re: Import Question

Okay, ultimately getting this to work wasn’t too hard. The steps:

  • Create a file called import.txt in the mtimport format. AUTHOR should be the TXP login you want to assign to the imported articles. See my other notes above.
  • Put the file in /textpattern/include/import
  • In TXP, go to Admin, Import. Set “Import from” to “Movable Type (file)”. Complete the rest of the form.
  • Hit “Continue” and cross your fingers. I got a pile of “Array to string conversion” warnings, and then a list of the successfully imported articles.
  • If your imported articles were already in Textile, you’re good to go. If they are in HTML, run this query against your TXP MySQL database: update textpattern set textile_body=0 This sets the “Article Markup” setting for each article to “Leave text untouched.”

That did it for me, I hope somebody else finds this useful.

Thanks!

Jim

Offline

Board footer

Powered by FluxBB