6 Replies Latest reply on Sep 27, 2010 1:47 AM by Jeff Coughlin

    ColdFusion slideshow possibilities?

    cfsetNewbie Level 1

      Hello;

      I am trying to come up with a way to make a coldfusion slideshow using cf code and javascript. I am hoping someone can help focus me into a proper solution. In my head, it seems kind of easy, I would just need a java script "timer" of sorts to cycle through all the records in the database, or turn it off and do it manually. I am going to post my coldfusion portion of the code.. maybe someone can either point me in the direction of a site with a tutorial, or help me with the java portion?

       

      Normal cf query with paging function-

       

      <cfquery NAME="slideShow" datasource="#APPLICATION.dataSource#">
      SELECT ID, mainImage, content
      FROM slide
      ORDER BY ID
      </cfquery>
      <cfset rowsPerPage = 1>
      <cfparam name="URL.startRow" default="1" type="numeric">
      <cfset totalRows = slideShow.recordCount>
      <cfset endRow = min(URL.startRow + rowsPerPage - 1, totalRows)>
      <cfset startRowNext = endRow + 1>
      <cfset startRowBack = URL.startRow - rowsPerPage>

       

      <cfloop query="slideShow" startRow="#URL.startRow#" endrow="#endRow#">

      <cfoutput>

      #mainImage#
      #content#
      </cfoutput>

      </cfloop>

       

      I'm not loading it up with layout code or anything.. I am just putting the hard code for this.. I also want to have links to go back to each record, something like this....

       

      <cfset thisPage = 1>
      <cfloop from="1" to="#totalRows#" step="#rowsPerPage#" index="pageRow">
      <cfset isCurrentPage = (pageRow gte URL.startRow) and (pageRow lte endRow)>
      <cfif isCurrentPage>
      <cfoutput>#thisPage#</cfoutput>

      <cfelse>

      <cfoutput>
      <a href="#CGI.script_name#?startRow=#pageRow#" class="nav">#thisPage#</a>

      </cfoutput>

      </cfif>
      <cfset thisPage = thisPage + 1>
      </cfloop>


      I am not sure how easy it is going to be to make it automatically go through the records without reloading the page.. maybe using an ajax control or javascript is what I'm thinking. I know this can be done in flash, but I'm not good enough with flash to use remoting and create it...

       

       

      Can anyone either point me in the right direction or help me out with a script that might work this type of a small app?

       

      Thank you