<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Debut Creative &#187; ASP</title>
	<atom:link href="http://debutcreative.com/tag/asp/feed" rel="self" type="application/rss+xml" />
	<link>http://debutcreative.com</link>
	<description>web development studio</description>
	<lastBuildDate>Thu, 03 Mar 2011 16:12:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Migrating data from ASP to WordPress</title>
		<link>http://debutcreative.com/migrating-data-from-asp-to-wordpress</link>
		<comments>http://debutcreative.com/migrating-data-from-asp-to-wordpress#comments</comments>
		<pubDate>Wed, 05 Aug 2009 14:13:43 +0000</pubDate>
		<dc:creator>ArleyM</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://debutcreative.com/?p=471</guid>
		<description><![CDATA[My personal site ArleyM.com has been an ASP site for about six years now, but the time has finally come to port over to WordPress and PHP. A lot of the heavy lifting was done over a year ago when I experimented with using Blogger as an RSS powering blog engine, but there was still [...]]]></description>
			<content:encoded><![CDATA[<p>My personal site ArleyM.com has been an ASP site for about six years now, but the time has finally come to port over to WordPress and PHP. A lot of the heavy lifting was done over a year ago when I experimented with using Blogger as an RSS powering blog engine, but there was still some content fueled by a Microsoft Access Database.</p>
<p>In early 2004 I started a database of my Top5 high rotation songs of the week. This was a very simple database table with eight fields. It&#8217;s been very rewarding to see this progress kept, so naturally I want to bring it into the new site. On the former version of the site ASP calls the database, and repeats each row of data in a table. I <em>could</em> just copy and paste the HTML tables after they&#8217;ve been rendered, but where&#8217;s the fun in that? I&#8217;d prefer to have each table fall into my blog on the appropriate date for the last five years.<span id="more-471"></span></p>
<div id="attachment_473" class="wp-caption aligncenter" style="width: 560px"><a href="http://debutcreative.com/wp-content/uploads/2009/08/dbold.gif"><img class="size-large wp-image-473" title="Original Database" src="http://debutcreative.com/wp-content/uploads/2009/08/dbold-550x129.gif" alt="click to enlarge" width="550" height="129" /></a><p class="wp-caption-text">click to enlarge</p></div>
<p>WordPress naturally doesn&#8217;t import .mdb files natively, so I knew there would be some wrestling with data! Under Tools &gt; Import WordPress has several proprietary formats it can import, as well as the ubiquitous RSS feed. I decided to convert my database into RSS.</p>
<p>At first I thought it might be a simple matter of exporting the XML (which RSS is a form of), but this was going to require some ugly code work to fit the RSS 2.0 format. In the end, I modified the old recordset page to render the RSS for me!</p>
<p>The old recordset page would call to the database, then populate a table with the songs like so:</p>
<p><a href="http://debutcreative.com/wp-content/uploads/2009/08/oldrender.gif"><img class="aligncenter size-full wp-image-474" title="Old Table Render" src="http://debutcreative.com/wp-content/uploads/2009/08/oldrender.gif" alt="Old Table Render" width="546" height="163" /></a></p>
<p>This was done with code like:</p>
<p><span style="font-family: -webkit-monospace;">&lt;tr&gt;<br />
&lt;td width=&#8221;13%&#8221;&gt;one.&lt;/td&gt;<br />
&lt;td width=&#8221;87%&#8221;&gt;&lt;%=(t5.Fields.Item(&#8220;songone&#8221;).Value)%&gt;&lt;/td&gt;<br />
&lt;/tr&gt;</span></p>
<p>So it&#8217;s just a simple matter of changing up the body content! Obviously I don&#8217;t want to do my site layout in Tables again, opting for CSS styling on a list.</p>
<p>As already stated, ASP gathers the records in a Repeat Region. RSS likes content repeated with the &lt;item&gt; tag. So in the end my new ASP record code looked like:</p>
<p><span style="font-family: -webkit-monospace;"><br />
&lt;item&gt;<br />
&lt;title&gt;Top5 Tracks for the week of &lt;%=(t5.Fields.Item(&#8220;date&#8221;).Value)%&gt;&lt;/title&gt;<br />
&lt;pubDate&gt;&lt;%=(t5.Fields.Item(&#8220;date&#8221;).Value)%&gt;&lt;/pubdate&gt;<br />
&lt;category&gt;Top5&lt;/category&gt;<br />
&lt;content:encoded&gt;&lt;ol&gt;<br />
&lt;li&gt;&lt;%=(t5.Fields.Item(&#8220;songone&#8221;).Value)%&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;%=(t5.Fields.Item(&#8220;songtwo&#8221;).Value)%&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;%=(t5.Fields.Item(&#8220;songthree&#8221;).Value)%&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;%=(t5.Fields.Item(&#8220;songfour&#8221;).Value)%&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;%=(t5.Fields.Item(&#8220;songfive&#8221;).Value)%&gt;&lt;/li&gt;<br />
&lt;%  IF TextShow &lt;&gt;&#8221;" THEN%&gt;<br />
&lt;li&gt;Guilty Pleasure: &lt;%=(t5.Fields.Item(&#8220;guilty_pleasure&#8221;).Value)%&gt;<br />
&lt;/li&gt;&lt;%ELSE%&gt;&lt;%End If%&gt;&lt;/ol&gt;&lt;/content:encoded&gt;<br />
&lt;/item&gt;<br />
</span></p>
<p>Now when this renders I can view the source and I&#8217;ll have all of my data nicely listed within &lt;Item&gt; Tags! (<em>Note: the entire &lt;content:encoded&gt;tag must be on one line, it wouldn&#8217;t fit very nicely here</em>). I went into the rendered HTML, removed the head and footer HTML leaving just the Items.</p>
<p>Next I created an XML file to be my importable RSS. I added the header and footer to the file:<br />
<span style="font-family: -webkit-monospace;"><br />
&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;channel&gt;<br />
&lt;title&gt;Top5 High Rotation Tracks &lt;/title&gt;<br />
&lt;link&gt;http://arleym.com/&lt;/link&gt;<br />
&lt;description&gt;High rotation tracks of the week&lt;/description&gt;<br />
items will paste here&#8230;<br />
&lt;/channel&gt;<br />
&lt;/rss&gt;<br />
</span></p>
<p>Then it was a simple matter of pasting in the rows of &lt;Item&gt; after the RSS description, and uploading into WordPress.</p>
<p>The only snag I hit was when all of the dates were coming off as December 31, 1969. I quickly realized that the Date column in my database was actually a text field with entries in the format of &#8220;08.0-5.09&#8243; (mm.dd.yy), which looked cool, but meant nothing to the database. A simple find and replace on the period and editing the field to be short-date resolved this issue nicely.</p>
<p>You can download my RSS Rendering page and my RSS headers here: <a href="http://debutcreative.com/wp-content/uploads/2009/08/RSS_Maker.asp">RSS_Maker.asp</a> &amp; <a href="http://debutcreative.com/wp-content/uploads/2009/08/rss.xml">RSS.xml</a></p>
]]></content:encoded>
			<wfw:commentRss>http://debutcreative.com/migrating-data-from-asp-to-wordpress/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

