Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2007



Tip: Looking for answers? Try searching our database.

It can't be done in coldfusion  !!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
whereskris - 12 Sep 2007 06:48 GMT
Hi
I am trying to create a master detail page for a photography site, easy enough
but I am trying to put next and previous links on the detail page next to the
image so that you can go to the next and previous record from the original
query on the detail page.

I have tried everything but can't get it working, I read a few forums and they
said it couldn't be done so here's a challenge if anyone would like to accept
it.

I somehow need to get the original recordset from the master page across to
the detail page and what position the photo had in the recordset.

Please help
Kris

Here is some crude code

<!--- master page --->

<cfquery name="master" datasource="#Application.dsn#">
SELECT *
FROM Photos
ORDER BY PhotoRating ASC
</cfquery>

<cfoutput query="master">
<a href="detail.cfm?PhotoDatabaseID=#master.PhotoDatabaseID#">
<img src="#Application.PathToPhotos##master.Image#" width="100" />
</a>
</cfoutput>

<!--- detail page --->

<cfquery name="detail" datasource="#Application.dsn#">
SELECT *
FROM Photos
WHERE PhotoDatabaseID = <cfqueryparam value="#URL.PhotoDatabaseID#"
cfsqltype="cf_sql_numeric">
</cfquery>

<img src="#Application.PathToPhotos##detail.Image#" width="800" />
<a href="detail.cfm?PhotoDatabaseID=#????????#">next</a> | <a
href="detail.cfm?PhotoDatabaseID=#??????#">previous</a>  |  <a
href="master.cfm">back</a>
Sean Corfield - 12 Sep 2007 07:37 GMT
>   I have tried everything but can't get it working, I read a few
> forums and they said it couldn't be done so here's a challenge if
> anyone would like to accept it.

Don't know which forums you were reading but this is trivial in CF.

You can put the start record number & records per page in the URL and
use those to drive the query on each page. For extra performance, you
can cache the query in session scope so you don't have to hit the
database on each page.

Signature

Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

cf.Objective() 2008
Early May, near Minneapolis, MN
The world's ONLY enterprise engineering conference for ColdFusion
http://cfobjective.com/

whereskris - 12 Sep 2007 09:49 GMT
Thanks for letting me know it can be done
but any example code would be greatly appreciated.
Kris
Azadi - 12 Sep 2007 10:09 GMT
google 'coldfusion pagination'
or search these forums for that or 'next n records'

Signature

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Dan Bracuk - 12 Sep 2007 17:33 GMT
Make your original recordset a session variable and then use query of queries to get what you need for each page.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.