<?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>DamonLedet.com&#187; Writing about technology, daily life, and other things I find interesting</title>
	<atom:link href="http://www.damonledet.com/blog/tag/cfloop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.damonledet.com</link>
	<description>Writing about technology, daily life, and other things I find interesting</description>
	<lastBuildDate>Thu, 27 May 2010 13:51:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Previous and Next in Coldfusion</title>
		<link>http://www.damonledet.com/blog/2007/12/26/previous-and-next-in-coldfusion/</link>
		<comments>http://www.damonledet.com/blog/2007/12/26/previous-and-next-in-coldfusion/#comments</comments>
		<pubDate>Wed, 26 Dec 2007 17:15:00 +0000</pubDate>
		<dc:creator>Damon Ledet</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Site Info]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[cfif]]></category>
		<category><![CDATA[cfloop]]></category>
		<category><![CDATA[cfoutput query]]></category>
		<category><![CDATA[cfset]]></category>
		<category><![CDATA[denver photos]]></category>
		<category><![CDATA[lytebox]]></category>
		<category><![CDATA[photo album pages]]></category>
		<category><![CDATA[photo id]]></category>
		<category><![CDATA[photos]]></category>

		<guid isPermaLink="false">http://new.damonledet.com/blog/2007/12/26/previous-and-next-in-coldfusion/</guid>
		<description><![CDATA[I have done this before when the data was clean and when I only needed to worry about one ID by just adding or subtracting one from the ID value. On my photo album pages I wanted to create a way to view my photos without lytebox. I have 2 IDs photo album and photo. [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: right;margin-left: 0.75em; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fwww.damonledet.com%252Fblog%252F2007%252F12%252F26%252Fprevious-and-next-in-coldfusion%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22Previous%20and%20Next%20in%20Coldfusion%22%20%7D);"></div>
<p>I have done this before when the data was clean and when I only needed to worry about one ID by just adding or subtracting one from the ID value. On my photo album pages I wanted to create a way to view my photos without <a href="http://www.dolem.com/lytebox/">lytebox</a>. I have 2 IDs photo album and photo. Also my data is not the cleanest for example in my <a href="http://www.damonledet.com/photos/denver/">Denver photos</a> I do not have a photo 1. I came up with a solution, not the most elegant I will admit. My work around for this problem includes looping the query to set the row number to a variable than instead of displaying against the photo ID I display against the row number. To create the next and previous I just add or subtract 1 from the row number. I also had to put a cfif to check to make sure my previous row variable was not -1. The code is below. You can see it in action <a href="http://www.damonledet.com/photos/photos.cfm/album/3/photo/1">here</a>.</p>
<blockquote><p><span style="color: #000000;"><span style="color: #990033;">&lt;cfloop query=<span style="color: #0000cc;">&#8220;QPhotos&#8221;</span>&gt;</span><br />
<span style="color: #990033;">&lt;cfif QPhotos.Photo_ID eq URL.PHOTO&gt;</span><br />
<span style="color: #990033;">&lt;cfset<span style="color: #000000;"> displayrow = QPhotos.currentrow</span>&gt;</span><br />
<span style="color: #990033;">&lt;/cfif&gt;</span> <span style="color: #990033;">&lt;/cfloop&gt;</span><br />
<span style="color: #990033;">&lt;cfset<span style="color: #000000;"> nextrow = displayrow+1</span>&gt;</span><br />
<span style="color: #990033;">&lt;cfset<span style="color: #000000;"> previousrow = displayrow-1</span>&gt;</span><br />
&#8230;<br />
<span style="color: #990033;">&lt;cfif previousrow GT 0&gt;</span><span style="color: #990033;">&lt;cfoutput query=<span style="color: #0000cc;">&#8220;QPhotos&#8221;</span> startrow=<span style="color: #0000cc;">&#8220;#previousrow#&#8221;</span> maxrows=<span style="color: #0000cc;">&#8220;1&#8243;</span>&gt;</span><br />
&#8230;<br />
<span style="color: #990033;">&lt;cfoutput query=<span style="color: #0000cc;">&#8220;QPhotos&#8221;</span> startrow=<span style="color: #0000cc;">&#8220;#displayrow#&#8221;</span> maxrows=<span style="color: #0000cc;">&#8220;1&#8243;</span>&gt;</span><br />
&#8230;<br />
<span style="color: #990033;">&lt;cfoutput query=<span style="color: #0000cc;">&#8220;QPhotos&#8221;</span> startrow=<span style="color: #0000cc;">&#8220;#nextrow#&#8221;</span> maxrows=<span style="color: #0000cc;">&#8220;1&#8243;</span>&gt;</span></span></p></blockquote>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.damonledet.com/blog/2007/11/15/export-categories-in-blogcfc-google-sitemap/" rel="bookmark" class="crp_title">Export Categories in Blogcfc Google Sitemap</a></li><li><a href="http://www.damonledet.com/blog/2007/11/18/using-cfimage-to-create-thumbnails/" rel="bookmark" class="crp_title">Using cfimage to create thumbnails</a></li><li><a href="http://www.damonledet.com/blog/2007/11/21/using-cfimage-to-create-a-watermark/" rel="bookmark" class="crp_title">Using CFIMAGE to create a watermark</a></li><li><a href="http://www.damonledet.com/blog/2008/03/11/css-link-color-question/" rel="bookmark" class="crp_title">CSS link color question</a></li><li><a href="http://www.damonledet.com/blog/2005/12/31/kitty-hawk-vacation-december-2005/" rel="bookmark" class="crp_title">Kitty Hawk Vacation December 2005</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div><script src="http://feeds.feedburner.com/~s/?i=http://www.damonledet.com/blog/2007/12/26/previous-and-next-in-coldfusion/" type="text/javascript" charset="utf-8"></script>
]]></content:encoded>
			<wfw:commentRss>http://www.damonledet.com/blog/2007/12/26/previous-and-next-in-coldfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
