Skip to main content
Known Participant
January 21, 2007
Answered

next n records interfaces

  • January 21, 2007
  • 3 replies
  • 385 views
am having a problem with my next_n records interface.

I have a query for my index page, so when you click on a lettter the appropriate artists are shown....
see here

http://www.musicexplained.co.uk/index.cfm

the query depends on a url variable.

<cfquery name="results" datasource="#APPLICATION.DataSource#">
SELECT *
FROM artist_art
WHERE bandname_art like '#url.firstletter#%'
</cfquery>

i am now setting up a next records interface, so you can easily browse through the artists who begin with a for example, this interface is also dependant on an URL variable....<cfset startrownext>
however, when I click on the next button, see here
http://www.musicexplained.co.uk/index_list_1.cfm?firstletter=a
i lose the variable which is powering the index in the first place..

is there anyway round this?

regards


This topic has been closed for replies.
Correct answer
Put this near the top of index_list_1.cfm:

<CFPARAM name="URL.firstletter" type="regex" pattern="[a-zA-Z]" default="a">
<CFPARAM name="URL.startrownext" type="integer" default="1">


Then in all of your pagination links, also include the firstletter parameter again:

<CFOUTPUT>
<a href="#CGI.SCRIPT_NAME#?firstletter=#URL.firstletter#&startrownext=1">First</a>
<a href="#CGI.SCRIPT_NAME#?firstletter=#URL.firstletter#&startrownext=#URL.startrownext + 10#">Next</a>
etc., etc.
</CFOUTPUT>

3 replies

Inspiring
January 25, 2007
If you want to get a bit fancier, the best CustomTag I've seen for pagination is CF_Search_NextPrevious:

http://www.jeffcoughlin.com/blog/index.cfm/2005/9/12/CFSearchNextPrevious-Custom-Tag-Update-v110
namtaxAuthor
Known Participant
January 22, 2007
thanks for this, will give it a go and get back to you
Correct answer
January 21, 2007
Put this near the top of index_list_1.cfm:

<CFPARAM name="URL.firstletter" type="regex" pattern="[a-zA-Z]" default="a">
<CFPARAM name="URL.startrownext" type="integer" default="1">


Then in all of your pagination links, also include the firstletter parameter again:

<CFOUTPUT>
<a href="#CGI.SCRIPT_NAME#?firstletter=#URL.firstletter#&startrownext=1">First</a>
<a href="#CGI.SCRIPT_NAME#?firstletter=#URL.firstletter#&startrownext=#URL.startrownext + 10#">Next</a>
etc., etc.
</CFOUTPUT>