I've already had a few requests to update the list of sites over on the Model-Glue site. I thought I'd share the Super Cool code I used to build the page. I didn't want to use the database, so I whipped up the following precious bit of code:
<!--- Ray's hack to avoid a DB. Yes, this is the suck. --->
<cfset sites = queryNew("title,url,description")>
<cfsavecontent variable="data">
iRovr@http://www.irovr.com@iRovr is a unique social experience developed exclusively for the iPhone. Members can blog, share photos, bookmark urls and link to YouTube videos by sending emails to POP aliases created specifically for their account.
Stavanger2008@http://www.stavanger2008.com@In 2008 Stavanger (norway) will be the European Capital of Culture. This is his official web site.
BPO Pros@http://bpoprosonline.com@MI based Realtor
</cfsavecontent>
<cfset data = trim(data)>
<cfloop index="line" list="#data#" delimiters="#chr(13)##chr(10)#">
<cfset site = listFirst(line,"@")>
<cfset theurl = listGetAt(line,2,"@")>
<cfset desc = listLast(line,"@")>
<cfset queryAddRow(sites)>
<cfset querySetCell(sites, "title", site)>
<cfset querySetCell(sites, "url", theurl)>
<cfset querySetCell(sites, "description", desc)>
</cfloop>
I deleted some of the text data - but as you can see - I build a fake query based on a string delimited by @ signs. The first part of each line is the site title, then the URL, and then the description. Later on in the page I just output over the query like it was any other 'real' query. If I ever make a real database application out of this page, I just need to point to a CFC to get the query.
Archived Comments
@Raymond:
I tend to use † chr(134) as a delimiter if I need to delineate a string. You can also use a non-printable character like chr(1). If you hold the [ALT] and on the number pad use the 4-digit ASCII code, it'll output the character. So, to type chr(134), you press [ALT] and then [0], [1], [3] and finally [4].
I've just run into problems using other characters in the past. A URL *could* have an @ symbol in it--like Amazon uses.
Yep, hence the term- cheesy. ;)
When I am working on something that does not have a database yet, I always use QuerySim by Hal Helms.
http://www.halhelms.com/ind...
Dear God, Ray... why do that? Why not use XML or WDDX for that? WDDX is still very handy for a lot of things.
Errr, are you saying I should type in XML? Why would I type in XML instead of just simple strings. Right now I use one char, @, to separate fields. For a hack - I went for simplicity.