Previous Record Previous Record Next Record Next Record ========================================================================== [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Wants2learn [ip] => sorcecer@hotmai [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> ? Previous record [b]NO MORE RECS[b] [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Wants2learn [ip] => sorcecer@hotmai [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 6 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> select * from tDetails'   
Previous Record Previous Record Next Record Next Record
#getRecs.moreInfo#
[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Wants2learn [ip] => sorcecer@hotmai [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 8 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> select * from tDetails
GALLERY OF PRODUCTION
select * from tDetails
 click for more info for #getRecs.ID# 
select * from tDetails --where infoName = '#URL.infoName#'   
Previous Record Previous Record Next Record Next Record
#getRecs.moreInfo#
[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Wants2learn [ip] => sorcecer@hotmai [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 10 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) -->
GALLERY OF PRODUCTION
SELECT ID FROM tDetails
 click for more info for #getRecs.ID# 
SELECT ID, Folder, PicName, moreInfo FROM tDetails   
Previous Record Previous Record Next Record Next Record
#getRecs.moreInfo#
[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => mxstu [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 12 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Next/Previous help - Coldfusion - Getting Started

Next/Previous help - Coldfusion - Getting Started

Hi people, I came across a problem and need some help. My application uses a next/previous method pf showing records. My code worked great until I realized a design flaw, hence why I'm here. I show one record at a time and have a text link like "NEXT" and "PREVIOUS" to go forward or back one record. Like I said, it worked fine until I realized something: if I delete a record for the database then my next/previous doesn't work. So obviously, my question is, how can I get it work? What I want to know is (and I know ...

  1. #1

    Default Next/Previous help

    Hi people, I came across a problem and need some help. My application uses a
    next/previous method pf showing records. My code worked great until I realized
    a design flaw, hence why I'm here. I show one record at a time and have a text
    link like "NEXT" and "PREVIOUS" to go forward or back one record.

    Like I said, it worked fine until I realized something: if I delete a record
    for the database then my next/previous doesn't work. So obviously, my question
    is, how can I get it work?

    What I want to know is (and I know this must be doable), how can I show the
    next record if records 2 and 3 are deleted from the database? How can I go
    from record 1 to record 4? I know the problem is in my 'evaluate' expression,
    since I am incrementing/decrementing the myID value by one it is looking for
    the deleted record id. How can I fix this?

    Need help.



    ================================================== ========================
    This is my code:

    <cfquery name="getRecs" datasource="#ds#">
    select * from tDetails where myID = '#URL.myID#'
    </cfquery>

    <cfoutput query="getRecs">

    <!--- if the record is lte 1 then do not show the link, only text --->
    <cfif myID lte 1>
    Previous Record
    <!--- else, show the link and decrement the 'myID' count by one:
    Evaluate(getRecs.myID-1) --->
    <cfelse>
    <a href="#cgi.SCRIPT_NAME#?myID=#Evaluate(getRecs.myI D-1)#">Previous
    Record</a>
    </cfif>

    <!--- if myID is gte the max recordcount in database, show only text no link
    --->
    <cfif myID gte maxRecIs>
    Next Record
    <!--- else, show the link and increment the 'myID' count by one:
    Evaluate(getRecs.myID+1) --->
    <cfelse>
    <a href="#cgi.SCRIPT_NAME#?myID=#Evaluate(getRecs.myI D+1)#">Next
    Record</a>
    </cfif>
    </cfoutput>
    ================================================== ========================

    Wants2learn Guest

  2. #2

    Default Re: Next/Previous help

    Anyone?
    Wants2learn Guest

  3. #3

    Default Re: Next/Previous help

    Does anyone have any ideas?
    Wants2learn Guest

  4. #4

    Default Re: Next/Previous help

    You can find an example here of what you want.

    [url]http://tutorial20.easycfm.com/[/url]

    Good luck.
    kidvolt Guest

  5. #5

    Default Re: Next/Previous help

    I don't have time to look at it right now, but you need to use the "number of
    results", not the record Id's themselves. For instance, if your table contains
    50 records, each page will show item N of 50 results (sorted by title, date,
    etc). Where N is the position in the result set (not a record ID) .

    If you search the back posts (either here or using google groups) you should
    find a number of posts on this topic that may help you get started.

    [url]http://groups-beta.google.com/groups?hl=en&q=macromedia+PAGE+NEXT+PREV&qt_s=Sear[/url]
    ch

    mxstu Guest

  6. #6

    Default Re: Next/Previous help

    Thanks for the reply. I had already looked at the easycfm tutorial and tried
    to use it. It doesn't work for me. I am only displaying one record at a time
    (similar to what a photo gallery does). My 'start' is 1 and my 'disp' is 1.
    Basically the CFOUTPUT looks like <cfoutput query="getPics" startrow="1"
    maxrows="1">.

    The PREVIOUS link always shows 'NO MORE RECS' (the <cfelse> clause). The code
    looks like:

    Also, I have my entire code wrapped around this clause: <cfif
    isdefined("URL.myID")>...</cfif> This is to make sure that the myID is present
    in the URL. For the purpose of this, I commented out that conditional clause.

    Any suggestions?



    <!--- Display prev link --->
    <CFIF start gt 1>
    <CFIF start lt disp>
    <CFSET prev=disp>
    <CFSET prevrec=start - disp>
    <CFELSE>
    <CFSET prev=start - 1>
    <CFSET prevrec=1>
    </CFIF>
    <font face="wingdings">?</font> <a
    href="#cgi.SCRIPT_NAME#?start=#prevrec#">Previous record</a>
    <cfelse>
    [b]NO MORE RECS[b]
    </CFIF>

    Wants2learn Guest

  7. #7

    Default Re: Next/Previous help

    Originally posted by: Wants2learn
    Also, I have my entire code wrapped around this clause: <cfif
    isdefined("URL.myID")>...</cfif> This is to make sure that the myID is present
    in the URL


    Assuming"myID" corresponds to a single record in your table... I think you are
    misunderstanding how the NEXT / PREV page options in the tutorial work. The
    tutorial does not use the record ID's in your table at all. It uses a "start"
    number, which is position within your query results, not a record ID. For
    example, let's say your query sorted images alphabetically by "title" field.
    Your results might look something like this:

    myID, imageTitle
    21, Basketball
    18, Football
    7, Soccer

    On the first page the "start" number is 1 and the image displayed is
    "Basketball", on the second page the "start" number is 2 and the image
    displayed is "Football", etc. As you can see, the "start" number has nothing
    to do with your "myID" column.

    Try using the using the tutorial code again, without modifying anything other
    than the table/column names in the query and the number of records to display.
    I think you will find it works correctly.


    mxstu Guest

  8. #8

    Default Re: Next/Previous help

    Hi mxstu. You were right, I misunderstood the NEXT/PREVIOUS feature. I redid
    the code, and it works! Thanks a lot.

    But now I came across another problem. Let me tell you the setup so you have
    a better understanding.

    I use 2 iFrames that loads the info into one page (didn't want to use frames,
    so I used iFrames). Now one iFrame queries the dB and loads the info as a
    thumbnail-esq gallery, and when clicking on the link loads the full infomation
    on the top in the second iFrame.

    The first iFrame passes 'infoName' in the URL, but the NEXT/PREVIOUS passes
    'start' in the URL. So now when I click on the thumnails, nothing happens. I
    can't pass the URL.infoName into the query cause when I do that the
    NEXT/PREVIOUS feature doesn't work.

    Is there a way around this?





    =====
    loads the thumbnails-esq gallary of the content. Click on the link load the
    full content on top (showed in another iFrame)
    =====
    <cfoutput query="getRecs">
    <td>&nbsp;<a href="page2.cfm?infoName=#getRecs.infoName#"
    target="right">click for more info</a>&nbsp;</td>
    </cfoutput>

    =====
    loads the thumbnails-esq gallary of the content. Click on the link load the
    full content on top (showed in another iFrame)
    =====
    <!--- query pulls the current pic info depending on users choice --->
    <cfquery name="getRecs" datasource="#ds#">
    select * from tDetails'
    </cfquery>

    <cfoutput query="getRecs" startrow="#start#" maxrows="#end#">
    <tr>
    <td width="310">&nbsp;&nbsp;<img src="#getRecs.Folder#/#getRecs.PicName#"
    border="1"></td>
    <td width="310" align="center" valign="top">
    <table width="265" border="0" align="center" cellpadding="0"
    cellspacing="0">
    <tr align="center" valign="middle">
    <td width="132">
    <!--- Display prev link --->
    <cfif start GT 1>
    <cfif start GTE disp>
    <cfset prev=disp>
    <cfset prevrec=start - disp>
    <cfelse>
    <cfset prev=start - 1>
    <cfset prevrec=1>
    </cfif>
    <a href="#cgi.SCRIPT_NAME#?start=#prevrec#">Previous Record</a>
    <cfelse>
    Previous Record
    </cfif>
    </td>
    <td width="132" colspan="2">
    <!--- Display next link --->
    <cfif end LTE getRecs.RecordCount>
    <cfif start + disp * 2 GTE getRecs.RecordCount>
    <cfset next=getRecs.RecordCount - start - disp + 1>
    <cfelse>
    <cfset next=disp>
    </cfif>
    <a href="#cgi.SCRIPT_NAME#?start=#Evaluate("start + disp")#">Next
    Record</a>
    <cfelse>
    Next Record
    </cfif>
    </td>
    </tr>
    </table>
    <div align="center"><span class="text">#getRecs.moreInfo#</span></div>
    </td>
    </tr>
    </cfoutput>

    Wants2learn Guest

  9. #9

    Default Re: Next/Previous help

    I am not sure that I'm visualizing your page structure correctly. I can see
    that the second section uses an href=#CGI.SCRIPT_NAME# which may not give the
    desired results if it is within an IFRAME, but without seeing the full code,
    I'm just guessing. Can you post the relevant code for the main page (ie.
    with the <IFRAME> tags) and be sure to indicate which code comes from which
    page.

    mxstu Guest

  10. #10

    Default Re: Next/Previous help

    Hi mxstu. See below for the codes for all three files. I took out some
    tables, and text to make it cleaner to post.

    Basically, as the code shows, I have one main page that loads 2 iFrames.
    iFrame ONE pulls all the recs from the dB and shows them as a thumbnail-esq
    small 'click here' link so the user can click on a specific link to see only
    that product info (ala how a photo gallery works). iFrame TWO shows the full
    info based on the 'infoName' parameter as passed in the URL. Also, the second
    iFrame has the NEXT/PREVIOUS option so the user can go onto the next one
    without having to click on another link from iFrame ONE. (The boss wants it
    this way, I would just let the user click on the next link from iFrame ONE
    since the iFrames are both displayed on one page).

    This is the meat of the code, can you see what I can do to have both the
    NEXT/PREVIOUS feature and the clicking of a thumbnail (from iFrame ONE)?

    ================================================== ========


    <!--- START: MAIN PAGE: LOADS BOTH THE IFRAMES SO ALL CONTENT IS SHOWN IN ONE
    PAGE (ALT TO USING FRAMES) --->
    <cfquery name="getRecs" datasource="#ds#">
    select * from tDetails
    </cfquery>
    <body bgcolor="efefef">
    <table border="0" cellpadding="1" cellspacing="1" bgcolor="efefef"
    width="621">
    <tr bgcolor="efefef">
    <td align="right"><a href="javascript:parent.window.close()"><img
    src="/graphics/imgClose.gif" width="86" height="18" alt="" border="0"></a></td>
    </tr>
    <tr bgcolor="003366"><td colspan="2" class="title" height="25">GALLERY OF
    PRODUCTION</td>
    </tr>
    <tr>
    <td bgcolor="efefef" colspan="2">
    <!--- THE TOP IFRAME THAT LOADS ALL CONTENT IN ITS FULL. PASSES THE
    'INFONAME' IN THE URL TO LOAD THE RIGHT RECORD --->
    <iframe src="<cfoutput>page2.cfm?infoName=#getRecs.infoNam e#</cfoutput>"
    title="Production" width="620" height="185" name="right" frameborder="0"
    scrolling="NO"></iframe>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <!--- THE BOTTOM IFRAME THAT LOADS ALL CONENT AS A SHORT DESCRIPTION (ALA
    PHOTO GALLERY-ESQ) --->
    <iframe src="page1.cfm" title="Production" width="620" height="100"
    name="km_bottom" frameborder="0" scrolling="YES"></iframe>
    </td>
    </tr>
    </table>
    </body>
    <!--- END: MAIN PAGE: LOADS BOTH THE IFRAMES SO ALL CONTENT IS SHOWN IN ONE
    PAGE (ALT TO USING FRAMES) --->

    <!--- START: PAGE1.CFM THAT LOADS ALL CONTENT AS A SHORT DESCRIPTION. USER
    CLICKS ON THE LINK/IMAGE TO LOAD THE FULL CONTENT. --->
    <cfquery name="getRecs" datasource="#ds#">
    select * from tDetails
    </cfquery>

    <body bgcolor="efefef">
    <table border="0" cellpadding="1" cellspacing="1" bgcolor="efefef">
    <tr>
    <!--- PASSES THE 'INFONAME' IN THE URL TO THE SECOND IFRAME THAT LOADS THE
    FULL CONTENT OF THE PATICULAR --->
    <cfoutput query="getRecs">
    <td>&nbsp;<a href="page2.cfm?infoName=#getRecs.infoName#"
    target="right">click for more info for #getRecs.ID#</a>&nbsp;</td>
    </cfoutput>
    </tr>
    </table>
    </body>
    <!--- END: PAGE1.CFM THAT LOADS ALL CONTENT AS A SHORT DESCRIPTION. USER
    CLICKS ON THE LINK/IMAGE TO LOAD THE FULL CONTENT. --->

    <!--- START: PAGE2.CFM LOADS THE FULL INFO OF A PATICULAR INFO (ALSO HAS THE
    NEXT/PREVIOUS FEATURE) --->
    <cfquery name="getRecs" datasource="#ds#">
    <!--- IF I PASS THE WHERE CLAUSE THE CLICKING OF A LINK FROM IFRAME ONE
    WORKS, BUT THE NEXT/PREVIOUS DOESN'T, AND IF I COMMENT OUT THE WHERE CLAUSE THE
    NEXT/PREVIOUS WORKS AND THE CLICKING OF A LINK FROM IFRAME ONE DOESN'T WORK --->
    select * from tDetails --where infoName = '#URL.infoName#'
    </cfquery>

    <cfoutput query="getRecs" startrow="#start#" maxrows="#end#">
    <tr>
    <td width="310">&nbsp;&nbsp;<img src="#getRecs.Folder#/#getRecs.PicName#"
    border="1"></td>
    <td width="310" align="center" valign="top">
    <table width="265" border="0" align="center" cellpadding="0"
    cellspacing="0">
    <tr align="center" valign="middle">
    <td width="132">
    <!--- Display prev link --->
    <cfif start GT 1>
    <cfif start GTE disp>
    <cfset prev=disp>
    <cfset prevrec=start - disp>
    <cfelse>
    <cfset prev=start - 1>
    <cfset prevrec=1>
    </cfif>
    <a href="#cgi.SCRIPT_NAME#?start=#prevrec#">Previous Record</a>
    <cfelse>
    Previous Record
    </cfif>
    </td>
    <td width="132" colspan="2">
    <!--- Display next link --->
    <cfif end LTE getRecs.RecordCount>
    <cfif start + disp * 2 GTE getRecs.RecordCount>
    <cfset next=getRecs.RecordCount - start - disp + 1>
    <cfelse>
    <cfset next=disp>
    </cfif>
    <a href="#cgi.SCRIPT_NAME#?start=#Evaluate("start + disp")#">Next
    Record</a>
    <cfelse>
    Next Record
    </cfif>
    </td>
    </tr>
    </table>
    <div align="center"><span class="text">#getRecs.moreInfo#</span></div>
    </td>
    </tr>
    </cfoutput>
    <!--- END: PAGE2.CFM LOADS THE FULL INFO OF A PATICULAR INFO (ALSO HAS THE
    NEXT/PREVIOUS FEATURE) --->

    Wants2learn Guest

  11. #11

    Default Re: Next/Previous help

    Hi mxstu, any ideas on how i can get my application to work?
    Wants2learn Guest

  12. #12

    Default Re: Next/Previous help

    You can get it to work (sort of), but the problem I see with the two IFRAME
    approach is that it also suffers from problems, if a record is deleted after
    the main page is loaded. This may be acceptible to you, if your application
    only deletes records infrequently. However, you should be aware of this issue.


    The issue is that the bottom IFRAME is not reloaded when a link is clicked, so
    the page would still display links for items deleted after that page loaded. If
    a user clicks on a deleted item, the "right" IFRAME will be reloaded, but based
    on how the example code works, the "right" IFRAME would show the information
    for the wrong item. You reload the main page or both IFRAMEs whenever a link
    is clicked to ensure that both pages show the current informaiton, but that
    seems to defeat the purose of using the IFRAMEs this way.

    Also, the script from easycfm.com demonstrates the concept, but since it is
    just an example, it obviously needs some work, (ie. scoping variables,
    eliminating evaluate() calls, optimizing the cfquery, parenthesis to indicate
    order of operations, etc..)

    Sorry, I don't have time right now to give a more solid example. Hopefully
    these comments might point you in the right direction. I've modified your code
    slightly, so that it works but suffers from the problems mentioned above.






    <!--- START: MAIN PAGE: LOADS BOTH THE IFRAMES SO ALL CONTENT IS SHOWN IN ONE
    PAGE (ALT TO USING FRAMES) --->
    <body bgcolor="efefef">
    <table border="0" cellpadding="1" cellspacing="1" bgcolor="efefef"
    width="621">
    <tr bgcolor="efefef">
    <td align="right"><a href="javascript:parent.window.close()"><img
    src="/graphics/imgClose.gif" width="86" height="18" alt="" border="0"></a></td>
    </tr>
    <tr bgcolor="003366"><td colspan="2" class="title" height="25">GALLERY OF
    PRODUCTION</td>
    </tr>
    <tr>
    <td bgcolor="efefef" colspan="2">
    <iframe src="page2.cfm" title="Production" width="620" height="185"
    name="right" frameborder="0" scrolling="NO"></iframe>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <iframe src="page1.cfm" title="Production" width="620" height="100"
    name="km_bottom" frameborder="0" scrolling="YES"></iframe>
    </td>
    </tr>
    </table>
    </body>

    <!--- START: PAGE1.CFM THAT LOADS ALL CONTENT AS A SHORT DESCRIPTION. USER
    CLICKS ON THE LINK/IMAGE TO LOAD THE FULL CONTENT. --->
    <cfquery name="getRecs" datasource="#ds#">
    SELECT ID FROM tDetails
    </cfquery>

    <body bgcolor="efefef">
    <table border="0" cellpadding="1" cellspacing="1" bgcolor="efefef">
    <tr>
    <cfoutput query="getRecs">
    <td>&nbsp;<a href="page2.cfm?start=#CurrentRow#" target="right">click for
    more info for #getRecs.ID#</a>&nbsp;</td>
    </cfoutput>
    </tr>
    </table>
    </body>

    <!--- PAGE2.CFM LOADS THE FULL INFO OF A PATICULAR INFO (ALSO HAS THE
    NEXT/PREVIOUS FEATURE) --->
    <!--- THIS WOULD NOT WORK IF DISPLAYING MORE THAN 1 RECORD PER PAGE!!!! --->
    <CFPARAM name="start" default="1">
    <CFPARAM name="disp" default="1">

    <cfquery name="getRecs" datasource="#ds#">
    SELECT ID, Folder, PicName, moreInfo
    FROM tDetails
    </cfquery>

    <CFSET end = Start + disp>
    <CFIF start + disp GREATER THAN getRecs.RecordCount>
    <CFSET end=999>
    <CFELSE>
    <CFSET end = disp>
    </CFIF>
    <cfoutput query="getRecs" startrow="#start#" maxrows="#end#">
    <tr>
    <td width="310">&nbsp;&nbsp;<img src="#getRecs.Folder#/#getRecs.PicName#"
    border="1"></td>
    <td width="310" align="center" valign="top">
    <table width="265" border="0" align="center" cellpadding="0"
    cellspacing="0">
    <tr align="center" valign="middle">
    <td width="132">
    <!--- Display prev link --->
    <cfif start GT 1>
    <cfif start GTE disp>
    <cfset prev=disp>
    <cfset prevrec=start - disp>
    <cfelse>
    <cfset prev=start - 1>
    <cfset prevrec=1>
    </cfif>
    <a href="#cgi.SCRIPT_NAME#?start=#prevrec#">Previous Record</a>
    <cfelse>
    Previous Record
    </cfif>
    </td>
    <td width="132" colspan="2">
    <!--- Display next link --->
    <cfif end LTE getRecs.RecordCount>
    <cfif start + disp * 2 GTE getRecs.RecordCount>
    <cfset next=getRecs.RecordCount - start - disp + 1>
    <cfelse>
    <cfset next=disp>
    </cfif>
    <a href="#cgi.SCRIPT_NAME#?start=#Evaluate("start + disp")#">Next
    Record</a>
    <cfelse>
    Next Record
    </cfif>
    </td>
    </tr>
    </table>
    <div align="center"><span class="text">#getRecs.moreInfo#</span></div>
    </td>
    </tr>
    </cfoutput>

    mxstu Guest

  13. #13

    Default Re: Next/Previous help

    Hi mxstu. It workd beautifully! Thanks for all the help. I see your point
    about the deleting of records and not displaying the most accurate list in the
    iFrame's. As it stands, I will be the only deleting any records, and records
    will rarely ever be deleted. I will still play with a copy of the code to
    reload the iFrames on every click to ensure that the most updated info is
    brought back from the database.

    Once again, thank you!

    Wants2learn Guest

Similar Threads

  1. HELP! -- previous page in VB and ASP 3.0
    By segis bata in forum ASP Components
    Replies: 4
    Last Post: September 28th, 12:06 PM
  2. previous and next link
    By Phpu in forum PHP Development
    Replies: 0
    Last Post: September 5th, 06:08 PM
  3. [PHP] Get previous folder
    By Joshua Groboski in forum PHP Development
    Replies: 0
    Last Post: July 22nd, 03:42 PM
  4. Get previous folder
    By Matt Palermo in forum PHP Development
    Replies: 3
    Last Post: July 10th, 01:33 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •