Google Ads

Questions for the Author?

Navigation

 ·   Wiki Home
 ·   Wiki Help
 ·   Categories
 ·   Title List
 ·   Uncategorized Pages
 ·   Random Page
 ·   File Upload
 ·   Uploaded Files
 ·   Recent Changes
 ·   RSS
 ·   Atom
 ·   What Links Here

Active Members:

Search:

 

Create or Find Page:

 

View Expression Engine Migration Notes

AUGUST 17 2010: I'm moving from Expression Engine 1.6.8 back to WordPress 3.0.1, so I have to bring back all my entries back into WordPress! Yikes. First, getting the data out. There's a number of things I need to transition:

  • The WikiLab
  • The Podcast Blog
  • The Main Blog
  • All images
  • Remap all the URLs (which are dynamic) from the weird Expression Engine format to the WordPress format, and tell search engines that content has moved.
  • Move all the tracking information (Mint, Google Analytics)

The content itself consists of:

  • Entry Metadata
  • Three fields per entry: Summary, Body, Extended Text, and MP3 (for audio podcast links)
  • Entry Comments

Exporting Entries and Comments

A quick Google didn't reveal any obvious pre-built tools that are still available, so I'm going to follow th

  • Instructions on how to create the entry export within Expression Engine.
  • XML-based approach to creating export template. The ZIP file is missing, but here's an alternative on GoogleCode.
  • A blog post describing how one guy did it. He also, kindly, provides his scripts, which almost work. I had to rearrange some things and enter other things manually. The biggy was a missing {comment_id}; there's a bug (I think) in the WP import where if there is multiple comments but the comments don't have an id, then only one comment imports. It's not the case with posts, but comments break.

We can use Expression Engine's templating system to format the data the way we want it by rewriting an WXR file.

After getting past the export/import problem, I re-enabled my LZIL plugin (basically, copying the core code from my Expression Engine hacked version), and it still works. It doesn't work particularly will with the admin panel, but I can fix that in time.

Running both Expression Engine and WordPress at the same time

ROOT: The ExpressionEngine .htaccess file is a little more convoluted, but not by much, because I moved the index.php from out of the standard EE-style URL to hide it. So, it checks for existing named templates handled by EE, and rewrites them to use the index.php/segment URLs. Then it redirects feeds to FeedBurner, and also removes the leading www if it's used. Finally, it redirects old URLs of the archive/YYYY/MM/DD/slug style to its equivalent in EE.

DIRECTORY: I looked at the .htaccess file for WordPress 3.0.1, and it essentially has a simple rewrite rule to hide index.php and also to make anything that isn't an existing file or directory into a wordpress request. WP SuperCache adds a bunch of additional conditions to intercept this, checking for a variety of conditions before seeing if a GZ'd or html cache file already exists.

The behavior I want is to redirect everything in blog,page to the WP blog. Also, contact and about should direct to new pages. Everything else should stay.

[1] Use mod_rewrite in root .htaccess to redirect certain URLS to _ee/index.php:

  • move these: podcast | store | member | forums | wikilab | publiki | agenceum_wiki | gallery
  • don't move: blog | page | start | member | store | category | trackbacks | search|P[0-9]{2,8}

[2] use mod_rewrite in root .htaccess to translate old blog posts to the new ones. However, that's going to be a trick because EE doesn't the archive convention of YYYY/MM/DD to help with performance. WP doesn't recommend using a comment structure like this, and so I have implemented the YYYY/MM style archive structure. So HOW TO MAP them?

  • I could have a new URL structure that is davidseah.com/YYYY for my new archives, but have a page called "blog" that catches the old URLs and does something magical to the lookup.

  • as it turns out, WP3.0 ALREADY handles the old EE URL structure. So, if a link to /blog/page-slug goes to my wordpress blog, it automatically figures it out and pops up the correct structure. However, it doesn't response with a 301 redirect. It would be nice to hook that.

So I could theoretically relink my blog now, after I fix the cosmetic issues, but search engines crawling the site will not re-index the new location of pages. I think I need to add my own RewriteRule to WP, and have it handle something...

After some googling, it turns out that WordPress has canonical urls that are automatically generated for me. So...I don't have to do a damn thing. Awesome!


Migrating from WP2.1 to EE1.6x

These are my raw notes from migrating from WordPress 2.1 to Expression Engine.

JULY 4th Expression Engine Questions

Q: How to fix my permalinks to match my OLD ones?

http://davidseah.com/archives/2007/06/15/two-emergent-task-planner-user-mods/ ...should map to... http://davidseah.com/_ee/two_emergent_task_planner_user_mods/

From http://expressionengine.com/forums/viewthread/40222/

RewriteCond %{HTTP_HOST} ^www\.rousette\.org\.uk
RewriteRule ^blog\/archives\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/(.*)$ /index.php/site/article/$1 [L,R=Permanent]

Q: How do I remove index.php from the URLs?

DirectoryIndex index.php/index
RewriteEngine on
RewriteCond $1 !^(files|images|system|themes|favicon\.ico|robots\.txt|index\.php)
RewriteRule ^(.*)$ index.php/$1 [NC] 

I have to change the permalink symbol from _ to - too

Under Global Weblog Preferences. Word Separator for URL Titles

Q: HOW DO I import?

Use the MT EXPORTER SCRIPT in WordPress, then import into Expression Engine. You'll have to up the memory limits for PHP to something like 64MB first.

Q. How do I add a SEARCH box? http://expressionengine.com/docs/modules/search/index.html

Q. How do I add my static code for my subscription feeds?

A. Just plop it into the template. You do need to update your RSS feeds on Feedburner, but it's way easier than with WordPress.

Q. How do I run my EE installation from a subdirectory, but access through main root? A. http://expressionengine.com/wiki/Running_Multiple_Domains_or_Subdomains_or_Subsites/

Q. What's a good way to structure my templates?

A. There are template groups, and templates. You can do something like this:

{embed global/header} {embed weblog/content} {embed weblog/sidebar} {embed global/footer}

And here's a cool trick:

<body id="{segment_1}">

So you can target a lot of site-wide changes in CSS. You can also do conditional parsing in the CSS too.

Q. How do I implement my Selected Article Index? A. For now, just copy the links over

Q. How do I list my top-level blog categories? A. http://expressionengine.com/docs/modules/weblog/categories.html And use parent_only="yes"

Q. How do I implement my Recent Comments? A. http://expressionengine.com/docs/modules/comment/recent_comments.html

Q. What's wrong with my categories? A. The export script may have goofed them up, so I need to manually fix them.

Q. What's wrong with my post count? A. http://expressionengine.com/forums/viewthread/55384/P18/ Basically, recount members, change end to T=0, so it doesn't skip the first user

BLOG SPLIT:

New Format - Articles in Blog Posts, moved to Wiki Put Wiki on its own subdomain, running off same install Put Guild on its own subdomain, running off same install Productivity Blog - New Format

Q. How do I move Wikis?

Let's look at the DBs...the trick is moving the user database. Or maybe it's easier to upgrade the existing installation.

http://expressionengine.com/wiki/Moving_Servers/

CREATE NEW DATABASE / EE INSTALLATION

  • new database: ee_dseah, u:ee_dseah, p:g3mini2020
  • upload files
  • create new EE site
  • upload folder
  • from folder root:

    chmod 666 path.php system/config.php system/config_bak.php chmod 777 images/avatars/uploads images/captchas images/member_photos images/pm_attachments images/signature_attachments images/uploads system/cache mv system 000

go to http://davidseah.com/_ee/install.php

Delete install.php

IMPORT OLD ENTRIES!

There are no good WP->EE solution plugins, but Mark Reeves helped me out with what to do.

The basic idea: export all your WP tables, import them into the EE database, then write some SQL that copies the entries from the WP tables to the EE tables. It's very straightforward.

  1. Do a full export of WP database as SQL with PHPMyAdmin
  2. Do a full import of WP database into the new EE table Can't import greater than 2048MB (2GB)...we should be OK. Importing all tables except for Bad Behavior

So now I see all the tables that begin with wp_

I now need to do a selective copy. Clicked the SQL tab. http://sql.magicmiles.com/sqlinsert.html has the instructions

PAIN IN THE ASS!!! LET'S TRY AGAIN!!!

I decided to grab an export script, and this seemed to work. http://projects.codemonkeyramblings.com/2007/03/wordpress_to_movable_type_expo_1.php

The export-mt.php script lives in the root directory of the wordpress/ folder.

The imported entries were assigned to Dave However, the total post count didn't increment properly.

I hacked in the LZIL functionality on the pi.markdown script. It's 100K of script.

I am tempted to run everything from scratch from DavidSeah.Com. But I will continue to run it from the _EE directory.

OK, let's verify what's NEW in my installation:

Saving Everything to Files directory system/template_files 777 created Templates > Global Template Preferences - allow templates to be saved as files Basepath to TemplateFileDirectory. These are SERVER PATHS

Things to save:

  • LZIL changes made to some core file pi.markdown
  • save templates for web site transition

THE STEPS FOR GETTING THE WEBSITE TRANSITIONED:

(1) LOOK AT THE CURRENT TRANSITION SITE IN _EE

Copy down all the pages, and their template code. Fuck, the site got blown away because I didn't backup the files. STUPID ARCHITECTURE

So what I need to do now is recut the CSS. Blah. Let's do the same site, but make sure that the CSS is clean and works on IE7.

One issue to avoid is using margins on non-div elements to do padding. This creates bad mojo.

I converted to this doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">

Originally it was set to STRICT, and strange image gapping was occuring.

Notes on Templates: Template files are actually stored in system/template_files

I'm not sure what themes/site_themes...apparently is is the resources used by the file. However, once the theme is loaded, you can't easily switch the "look" of the site. The THEME here becomes a "resource". The davidseah.php is a one-time loaded file that's used to populate the database. After that, everything goes to system/template_files

Templates are sort of like Ruby on Rails, with access control

Hidden Templates

When you're creating them, give them a name preceding with a period. You can change this character in a secret preference in your config.php file

Other Templates

system/templates (not template_files) stores pre-designed .tpl files that you can use them here. This is different from the "themes" and "template_files". These are visible ONLY when you are acreating a NEW template.

Date Variable Formatting in Templates http://expressionengine.com/docs/templates/date_variable_formatting.html

Using a Plugin

In general, anything that's a module is implemented through {exp:name:name}

&#123;exp:xml_encode&#125;
content content content
&#123;/exp:eml_encode&#125;

Parameters occur after the first block! you can use these to control the module

Organizing your Site with {path=

// note this isn't on the ExpressionEngine Quick Reference Chart!
// lame!

It's all based around "template groups" and "templates".

&#123;path=template_group/template&#125; 

expands to

http://site/index.php/template_group/template

So if you are creating a link to your archives page, you'd do something like My Archive Pages

path pre-defined variables: {path="site_index"} {path="logout"}

Embedding Templates in Your Templates

Just use `` However, you can't use them inside the Forum Module or the MEmbership Templates You can also pass parameters to the {embed}, which will be then defined inside the next template.

Apparently, In the template, you can check for things being set with this: {if embed:dog_name}display if dog_name is set{/if}

Member Links

    // this seems to be a little more magical than I'd like...
    // lame!

    [url="{path=member/login}"]
    &lt;a href="{path=login}"&gt;
    &lt;a href="{path=member/register}"&gt;
    &lt;a href="{path=member/memberlist}"&gt;
    &lt;a href="{path=member/profile}"&gt;
    &lt;a href="{path=member/forgot_password}"&gt;

Member Inforamatin

    &#123;location&#125;
    &#123;ip-address&#125;
    &#123;member_id&#125;
    &#123;member_profile_link&#125;

Linking to Stylesheets

    &#123;stylesheet=template_group/css_template&#125;

This is similar to using {path=}, except the stylesheet isn't parsed as it is with {path=} It also happens to trigger the sending of text/css MIME headers, as a side effect.

Date-Based Manipulation

The {current_time} tag is parsed very early in the Template parser {total_queries

Embed Templates

    &#123;embed=template_group/template&#125;

Obfuscating Links

    &#123;encode="text to encode" title="Email me!"&#125;

URL to HOME PAGE (as defined in Admin > General Configuration)

    &#123;homepage&#125;

Information about logged-in user (a person who has admin access)

    &#123;ip_address&#125;
    &#123;screen_name&#125;
    &#123;user_name&#125;
    &#123;total_comments&#125;
    &#123;total_entries&#125;

Post Information

    &#123;template_edit_date&#125;

Site Performance

    &#123;total_queries&#125;
    &#123;webmaster_email&#125;
    &#123;hits&#125;
    &#123;gzip_mode&#125;
    &#123;elapsed_time&#125;
    &#123;debug_mode&#125;

ALTERNATIVE SYNTAX prepend logged_in. That's because some tags parse their own member information and the information is list.

MEMBERS versus USERS

Is there a difference? I don't think so. Members are members of the site, and have account information.

Setting up Global Variables

in path.php, create a $global_vars array

    $global_vars = array(
            "my_weblog_name" =&gt; "news",
            "my_template_group" =&gt; "display"
    ); // Last entry must not include the comma at the end

This adds new tags like {my_weblog_name} and {my_template_group} to EVERY template!

You can also use them in template conditions {if my_template_group == "display"} {/if}

There are USER DEFINED GLOBAL VARIABLES too, which you can set up in your Control Panel > Templates page. For static information. You can't redefine any existing global variables, though.

There are DYNAMIC VARIABLES which are set up with {assign_variable:var="assignment"}. They can expand into bunches of stuff.

Conditionals

    &#123;if&#125; &#123;if:ifelse&#125; &#123;if:elseif&#125;
    OR, XOR, AND
    ||, &&

    &#123;if logged_in&#125;
    &#123;if group_id==&#125;
    &#123;if logged_out&#125;
    &#123;if member_group&#125;
    &#123;if screen_name==&#125;
    &#123;if total_comments==&#125;
    &#123;if total_entries==&#125;
    &#123;if segment_X==&#125; this is URL segment parsing
    &#123;if username==&#125;

Segments

This is where EE becomes something like a framework like Rails. Buy using {segment_1} and so forth, you can access snippets from the URL and do things based on that. Note that these just expand into the actual word. But you can use the {if segment_x} formats for your basic conditionals.

Related Entries can be set up in Weblog Management > Custom Weblog Fields

BACKING UP YOUR EXPRESSION ENGINE INSTALLATION

Images: We're still storing out images in wp-content folder

Templates: Our theme resources are in themes/site_themes/, along with initialization file (same name as the directory). Also, pull the saved-file versions out of system/template_files/davidseah. You can go to Templates > Export Templates to dump them all!

Plugins: I have my own version of pi.markdown.php

Databases:

Let's take a look through the database interface... I think the easiest way to do it is to just drop the old website and start again.

So I go to the admin panel, go to weblog adminstration, then clicked delete.

Then I created a NEW WEBLOG: Full Weblog Name: David Seah: Better Living through New Media Shortname: davidseah Category Groups: Went back to category management, and deleted "default category group". Each weblog does need one, otherwise categories are not created. Fields: There are lots of custom fields you can add and do things to. Right now these are just regular entries. Entry Statuses: Open,Closed

After creating my new website (choosing not to create new templates, since I'm using the existing ones), I now need to export my weblog entries from my existing blog.

I'm using the script export-mt.php that I got from that site I mentioned...I think I had modified it slightly.

I have it in my wordpress folder, because it loads wp-config and wp-include/wp-db.php. It runs out of memory, so I have to increase my php allocation. php.ini memory_limit is set to 32M. I need to increase it to 64M.

[27-Oct-2007 22:35:31] PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 7446087 bytes) in /var/www/vhosts/davidseah.com/httpdocs/wordpress/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 126

can execute from the command line:

php export-mt.php > davidseah-com-export.mt mv davidseah-com-export.mt ../_ee/000/cp

Then go to weblog admin, utilities, import mt Default Entry Format: Markdown

disabled create members from commenters. commenter member group assignment is automatically guests.

I'M STARTING AGAIN

Nuking the entire database now. Reset everything. Unfortunately, the categories that got imported are screwed up and created duplicates.

This time, I need to import with NO subcategories. So redoing the installation

template group: blog category group: cat_davidseah site name: davidseah_com blog_name: blog_davidseah

on SITES: Site Label: davidseah_com, siteshortname: dscom

go to ADMIN, System Preferences > General Configuration .. enable multiple site manager

go to TEMPLATE tab, edit group .. rename to 'blog' .. add javascript template .. click Global Template Preferences, enable revisions, allow save as files .. set path to /var/www/vhosts/davidseah.com/httpdocs/_ee/000/template_files .. load and save each template of them with web interface to save files... .. go to dreamweaver and upload new files...

go to ADMIN tab, Weblog Administration > Weblog Management .. edit preferences Full Weblog Name = "David Seah: Better Living through New Media" .. short name: blog_davidseah

go to Admin > Weblog Admin > Global Weblog Prefs .. turn on category URL Titles in Links .. Turn on Caching .. change word separator to DASH

go to ADMIN > Weblog Admin > Custom Weblog Fields > Custom Fields .. go to FIELD OPTIONS and edit the "Default Text Formatting" for the field ,, change formatting for BODY and EXTENDED to use Markdown formatting .. when prompted, update all the fields

go to ADMIN tab, Weblog Administration > Category Management .. rename Blogging to Expression Engine .. rename Personal to System Notes .. change group to cat_davidseah .. click to member groups, add group DSG Webmasters

go to ADMIN tab, UTILITIES, Import Utility, Movable Type Import Utility .. location: davidseah-com-export.mt (same level as system/cp directory) .. Auto Create Categories (no sub-categories ... will re-parent them later) .. default entry format: markdown .. uncheck "create members from commenters" .. click import! .. on results page, click to update weblog statistics

clean up CATEGORIES .. go to ADMIN, Weblog Admin, Category Groups .. add/edit categories .. use OLD site as reference to re-link hierarchy as needed

turn of Emoticon Translation .. go to Admin > SYSTEM PREFERANCES > Emotican Preferences

reduce number of entries shown per page ..

FIX RSS for FEEDBURNER FEEDS .. rename rss_2.0 template to rss_2.0_fb (for feedburner)

NOW THERE ARE SOME REMAINING THINGS TO FIX...

x Rename group template from grp_davidseah to 'blog', update templates x split up index.php into a simple header, sidebar, and footer x Fix COMMENT LINKS x DISABLE WORDPRESS INSTALLATION x Fix CATEGORY LINKS x Fix ARCHIVES o Fix SEARCH o QUICKPOSTS x RSS UPDATE x Connect Main INDEX.PHP to _EE x Set up REDIRECTS x add REMAINING SIDEBAR STUFF x re-add STATISTICS SCRIPTS o recreate CONTACT FORM o recreate AdSense blocks!

Creating new global variables: ds_template_group and ds_weblog, to use in my templates.

THERE IS A BUG IN MY BUILD REGARDING CATEGORIES, WHICH IS WHY THEY ARE NOT WORKING!!! http://expressionengine.com/wiki/TShoot_Categories_Added_After_Update_Dont_Display/ Running this script fixed it: http://expressionengine.com/forums/viewthread/55581/

Removing INDEX.PHP

http://expressionengine.com/wiki/Cruft_Free_URLs/

Then I had to fix my templates to use site_url and point to the _ee directory explicitly in the case of themes.

It probably would be more portable to create a user defined global variable.

START SCRATCHPAD

#

#

Need to reinsert this into the sidebar

<h2 class="sidetitle">Categories</h2>

&#123;exp:weblog:categories weblog="&#123;ds_weblog&#125;" style="nested"&#125;
&lt;a href="{path={ds_template_group}/index}"&gt;&#123;category_name&#125;[/url]
&#123;/exp:weblog:categories&#125;

These are my original RSS links:

<link rel="alternate" type="application/rss+xml" title="RSS" href="{path={ds_template_group}/rss_2.0}" /> <link rel="alternate" type="application/atom+xml" title="Atom" href="{path={ds_template_group}/atom}" />

Fixing Conversion of Wordpress Posts to EE

In some cases, my extended data fields in EE contained the string "-----", which is a leftover importing the movable type-format export dump. This SQL statement purges them.

update exp_weblog_data set field_id_3 = replace(field_id_3, "-----", "");