Translating EE 1 code to EE 2
Hey - if you’re new to ExpressionEngine and are here on Train-ee.com looking for ExpressionEngine 2 tutorials - take heart. With a few minor tweaks any EE 1 template code will run just fine in EE 2.
Make no mistake - EE 2 is a significantly different product than EE 1. The main differences however are that EE 2 runs on CodeIgniter and the Control Panel is re-arranged and redesigned. While these changes have represented a significant amount of work for the EllisLab developers, they don’t change the fundamental approaches to building and implementing websites in ExpressionEngine.
If you are looking at some EE 1 template code - here on Train-ee or anywhere else - and want to use it in EE 2 just change the following (note again that this is EE template code and not plugin, extension or module code):
Weblog to Channel
Where you used to code something like:
{exp:weblog:entries dynamic="off" weblog="news" disable="trackbacks|pagination|member_data" sort="asc"}
<h3>{title}</h3>
{page_content}
{/exp:weblog:entries}
Your first revision would be to replace weblog with channel:
{exp:channel:entries dynamic="off" channel="news" disable="trackbacks|pagination|member_data" sort="asc"}
<h3>{title}</h3>
{page_content}
{/exp:channel:entries}
Dynamic = “no”
In EE 2 the dynamic property is now yes/no vs. on/off. So you’d then change the above code to:
{exp:channel:entries dynamic="no" channel="news" disable="trackbacks|pagination|member_data" sort="asc"}
<h3>{title}</h3>
{page_content}
{/exp:channel:entries}
Trackbacks Gone
EE 2 doesn’t have trackbacks - so there is no need to disable them. The updated code would be:
{exp:channel:entries dynamic="no" channel="news" disable="pagination|member_data" sort="asc"}
<h3>{title}</h3>
{page_content}
{/exp:channel:entries}
assign_variable Is Now preload_replace
If the code uses the assign_variable approach to building template-level variables those have been renamed to preload_replace.
So any EE 1 code like:
{assign_variable:weblogs="news|reviews"}
{exp:weblog:entries weblog="{weblogs}" limit="10"}
<h2>{title}</h2>
{body}
{/exp:weblog:entries}
Would be re-written as:
{preload_replace:channels="news|reviews"}
{exp:channel:entries channel="{channels}" limit="10"}
<h2>{title}</h2>
{body}
{/exp:channel:entries}
dynamic_start=“yes”
dynamic_start= is most commonly used in RSS templates, and (like the closely-named dynamic parameter mentioned above) has also changed from “on|off” in EE 1 to “yes|no” in EE 2.
Those few changes are all that’s really needed to change most EE 1 code to work in EE 2. If you run across other versioning-related code changes need please let me know via the comments here.
As EE 1 is slated for retirement once EE 2 is released will be working through the content here on Train-ee to update it to EE 2 code where it makes sense to do so.
Category Navigation




by Wojtek
Date: Tuesday, July 6th, 2010
Comment: #1
Great post.
Does anyone have a translation tool / converter yet for EE1 to EE2?
Maybe a couple of careful search and replace actions will do it for now.