[thelist] CurrentRow in CF

Joshua Olson joshua at alphashop.net
Tue Jun 12 01:18:09 CDT 2001


Aaron,

when you use <cfoutput> you will get outputted everything within the
recordset.  So, even if you use #CurrentRow# of #RecordCount# you will
indeed get:

1 of 5
2 of 5
3 of 5
4 of 5
5 of 5

So, if you are passing in the url somehow which record you are currently
viewing, say ?num=4, then add the following attributes to the <cfoutput>
tag--startrow and maxrows.  The resulting code will look something like
this:

<cfoutput query="myquery" startrow="#url.num#" maxrows="1">
  <cfif currentrow GT 1>
    <a href="#cgi.script_name#/?num=#Val(url.num - 1)#">&lt; Prev</a>
  </cfif>

  #CurrentRow# of #RecordCount#

  <cfif currentrow LT recordcount>
    <a href="#cgi.script_name#/?num=#Val(url.num + 1)#">Next &gt;</a>
  </cfif>
</cfoutput>

This will cause the output to only include the one record pointed to by the
url attributes.

Does this answer your questions?

-joshau

-----Original Message-----
From: thelist-admin at lists.evolt.org
To: thelist at lists.evolt.org
Subject: [thelist] CurrentRow in CF


I'm trying to recreate a feature I've seen on a lot of sites where you get a
dynamic record count.  So, if there are 5 pictures in a set and you're
viewing the third one, it will say 3 of 5.

I thought I had it figured out by using #CurrentRow# of #RecordCount#.

Alas, no.

When I output this I get all five possibilities at once.  Arrgh!! So close.

Can someone point me in the right direction?

TIA,
Aaron





More information about the thelist mailing list