Search This Blog

Thursday, January 10, 2008

Exporting from Expression Engine (step by step)

I promised the friendly folks over at textpattern that I would write something about exporting entries from expression engine.

This link in the ee wiki MOSTLY covers it. I say mostly, because you'll need to make some modifications which are not listed but that I am including. Additionally, you will need to be careful to do all of the steps in order, so I'm just going to go step by step. Also, if you have used subcategories, I haven't found a way to capture that hierarchical structure. So, depending on what kind of software you are importing these into, you may need to tweak your categories. In textpattern for example, all of the categories go to multiple unfiled categories. It's easy enough to then just update them in textpattern. This will export everything in Movable Type (MT) format.

Figure out your blog's name before you start. In expression engine>CP Home › Admin › Weblog Administration › Weblog Management
Edit Preferences>Short Name

The short name is the actual name of your blog. Make a note of it, as you will need it later.


STEP 1: Create an export template group


Login to the control panel.

Click on templates.

Click on "Create new template group" button.
NOTE: You must start with a new template group.

Name your template group:

The name must be a single word with no spaces
(underscores and dashes are allowed)
Type in Export

Duplicate an Existing Template Group?
Choose> Do Not Duplicate a Group

Make the index template in this group your site's home page?
Whatever you do, DO NOT CHECK THIS box. This will override your template design for your blog.

Click Submit.

Okay, step 1 is finished. We've created a template group, but we now need to create the templates.
NOTE: Do not skip any steps.

STEP 2: Create the export template for comments
At this point, you should be back at your list of templates. In the left column, under the header, Template Management, you should see a list that includes all of your template groups.

Under Choose Group>Click on Export
In the column to the right of Choose Group, you should see a list. Click on New Template.
Now we will create templates for the comments and the entries. NOTE: Do not skip any steps.

The name must be a single word with no spaces
(underscores and dashes are allowed)
Type in Comments

Choose Template type> Webpage

Default Template Data
None - create an empty template

Click Submit.

We are back at the list.
Click on Preferences (in the column to the right of Choose Group, under the Export header)
The ONLY things to change here are
Allow PHP? Y
PHP Parsing? Input

Note: This must be set for this to work!

Click Update.

We are now back to the list of templates.
Okay, now we have to add the code to make this work.
Under
Template Name / Edit
To the left of Comments>Click on>View

Copy & paste the code below into the blank area. Note change "yourblog" to the shortname of your blog. Your blog's name is not what appears in the title bar of the html page. It is what you have listed in
Admin › Weblog Administration › Weblog Management > Edit Preferences>Short Name
The short name is the name of your blog.


global $IN;
$IN->QSTR = '{embed:the_entry_id}'

?>

{exp:comment:entries weblog="weblog1" sort="asc"}COMMENT:
AUTHOR: {name}
URL: {url}
DATE: {comment_date format="%m/%d/%Y %h:%i:%s %A"}
{comment}
-----
{/exp:comment:entries}

[/code]



Click Update and Finished.

STEP 3: Create the export template for index
At this point, you should be back at your list of templates. In the left column, under the header, Template Management, you should see a list that includes all of your template groups.

Under Choose Group>Click on Export
In the column to the right of Choose Group, you should see a list. Click on New Template.
Now we will create templates for the comments and the entries. NOTE: Do not skip any steps.

The name must be a single word with no spaces
(underscores and dashes are allowed)
Type in Index

Choose Template type> Webpage

Default Template Data
None - create an empty template

Click Submit.

We are now back to the list of templates.
Okay, now we have to add the code to make this work.
Under
Template Name / Edit
To the left of Index>Click on>View

Copy & paste the code below into the blank area.
Note change "yourblog" to the shortname of your blog. Your blog's name is not what appears in the title bar of the html page. It is what you have listed in Admin › Weblog Administration › Weblog Management > Edit Preferences>Short Name
The short name is the name of your blog.

Also note: If you have used the summary instead of the body then you will need to capture that info, too. I am including the summary because at some point, my blog posts switched to being in the summary. I probably did this out of laziness. ;-)

Note: This only includes the first 999 blog posts.
If you have more blogposts, try changing the number in limit to encompass all posts. If your export file truncates (doesn't include all posts) then you may need to do this in two batches.

{exp:weblog:entries weblog="yourblog" limit="999" rdf="off"}
AUTHOR: {author}
TITLE: {title}
STATUS: Publish
ALLOW COMMENTS: 2
CONVERT BREAKS: br
{categories}CATEGORY: {category_name}
{/categories}
DATE: {entry_date format='%m/%d/%Y %h:%i:%s %A'}
-----
BODY:
{body}
-----
EXTENDED BODY:
{extended}
-----
SUMMARY:
{summary}

-----
{embed="export/comments" the_entry_id="{entry_id}"}
--------
{/exp:weblog:entries}

Click Update and Finished.

STEP 4: Test the export!
We are now back to the list of templates. Check to make sure that you are right area.
Under Choose Group> Export

Next to index there are 2 Views listed. To the left is view template
(it is under the header:
Template Name / Edit. This is not the View you want. Under the header, View, which is to the right of the Template name Index, is a second View. Click on this view

If everything worked well (give it a second or two) , you should see a large kind of garbled looking file with your posts- this means the export is working. We will format it and save it in a minute. If you are having problems at this point, delete your templates and start over.

IF you are still having problems, drop me a line and I'll see if I can help you.
Now, to format and save it.

Go to View/ View source in Internet Explorer or Firefox (control + u). Save as index.txt


PROBLEMSOLVING:

Templates not working at all: Check your blog name. In expression engine>
CP Home › Admin › Weblog Administration › Weblog Management
Edit Preferences>Short Name
The short name is the name of your blog.



Missing info:
Take a look at your formatted export file.
If you are missing your posts or comments, now is the time to fix it. You will need to work on the export code to correct these.

Carriage returns/page breaks
If the code doesn't work, delete the extra spaces and then just do carriage returns.

Diacritics and special characters like & ' etc.
You may or may not need to correct these before you migrate into your new system. I opened the text file and corrected them all before I imported my entries into textpattern.

best of luck. Remember this export file is in MT (Movable Type) format. When you import it into a new software, if there is no import for MT then you may need to do some additional work.

20 comments:

Anonymous said...

ahh thank you! i've been trying to escape the realm of EE's ridiculous licenses and finding an alternative. i think i'll give textpattern a shot.

Robin said...

Something weird happened when I posted the code into blogger, so I've updated it as a quote to keep all of the formatting. Please make sure to doublecheck your code.

From ee export you can probably import into wordpress or really any blog format. ;-)
Yay! Free of ee.

Xavi said...

Hello, what do yoy suggest to export custom fields from EE to MT? Is it possible with your export method?

Robin said...

One of the questions will be is there a place to put the custom field into MT?

You should be able to export any field from EE. For custom fields, just include the tag you assigned for the custom field.

However, getting that field into MT, may be a bigger issue.

I did have some minor issues migrating to textpattern, mostly in that textpattern couldn't seem to keep the hierarchy of my subcategories. Overall, not a big a problem -- but it's certainly not a perfect solution.

best of luck.
robin

Anonymous said...

Nice post as for me. It would be great to read a bit more concerning this matter. Thanx for posting that data.
Sexy Lady
Busty London Escorts

Term Papers said...

It’s great to see good information being shared.

Term Paper said...

This is such a great news, it really helps,Thanks for convey the message, i really didn't know about that, will avail this,Thanks for share this.

Term Papers said...

This was some of the best information that I got from your blog. My friend suggested me to visit this blog. Really good one!

Resume Writing Service said...

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon.

escort in Kiev said...

I was very encouraged to find this site. I wanted to thank you for this special read. I definitely savored every little bit of it and I have you bookmarked to check out new stuff you post.

Custom Home Detailing said...

This is alot of good information. I will see if I can export in the FT. Thanks for taking the time on this.

Rain Gutter Cleaning said...

This is good step by step instuctions. We will share it with the class.

Anonymous said...

Thank you, the export process worked perfectly!

Anonymous said...

It's always nice when you can not only be informed, but also get knowledge, from these type of blog, nice entry. Thanks


http://www.boundlesstech.net

Apron said...

Valuable information and excellent design you got here!

cctv karachi said...

This is not the first of your posts I've read, and you never cease to amaze me. Thank you, and I look forward to reading more.

Wiley Koepp said...

Your documentation was more clear and accurate than what is in EE's own documentation, forums, and wiki. Thank you for taking the time to do this!

Custom made term papers said...
This comment has been removed by a blog administrator.
INDIANAPOLIS HOMES FOR SALE said...

so totally perfect! That is nice info, I can not wait the continuation of your blog. so i will say thanks for sharing this great stuff.

tkp said...

On the admin page of my EE (v1.7.1) site, rather than having a Weblog Administration option I have Channel Administration. How would I go about setting up the export in this case?