Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populating a table help

Status
Not open for further replies.

PTmon

IS-IT--Management
Joined
Mar 8, 2001
Messages
284
Location
US
Hi, I'm trying to populate a 3x3 table with thumbnail images. 9 Images per page. There will be around 100 images so I'll need previous and next buttons. I know how to do this with rows, with one image in each, but no idea how to even start doing it this way. Please help!!!
thanks,
PT
 
to loop through the query and get 3 records per row:

<cfloop index=&quot;i&quot; from=&quot;1&quot; to=&quot;#queryName.RecordCount#&quot; step=&quot;3&quot;>
<tr>
<td><img src=&quot;images/<cfoutput>#queryName.imagefield#</cfoutput>&quot; alt=&quot;&quot; width=&quot;184&quot; height=&quot;25&quot; border=&quot;0&quot;></td>
<td><img src=&quot;images/<cfoutput>#queryName.imagefield#</cfoutput>&quot; alt=&quot;&quot; width=&quot;184&quot; height=&quot;25&quot; border=&quot;0&quot;></td>
<td><img src=&quot;images/<cfoutput>#queryName.imagefield#</cfoutput>&quot; alt=&quot;&quot; width=&quot;184&quot; height=&quot;25&quot; border=&quot;0&quot;></td>
</tr>
</cfloop>


for next-previous records you can call the custom tag &quot;recordsdisplay.cfm&quot; with this:

<cfmodule template=&quot;../customtags/recordsdisplay.cfm&quot;
StartRow=&quot;#variables.StartRow#&quot;
RecordsPerPage=&quot;#variables.recordsPerPage#&quot;
QueryRecordCount=&quot;#queryName.RecordCount#&quot;>



recordsdisplay.cfm:

<cfparam name=&quot;attributes.StartRow&quot; default=&quot;0&quot; type=&quot;numeric&quot;>
<cfparam name=&quot;attributes.RecordsPerPage&quot; default=&quot;0&quot; type=&quot;numeric&quot;>
<cfparam name=&quot;attributes.QueryRecordCount&quot; default=&quot;0&quot; type=&quot;numeric&quot;>

<cfscript>


//set the default value for the page start row
variables.startRow = IIf(attributes.startRow GT attributes.queryrecordcount, attributes.queryrecordcount, attributes.startRow);

//set the default value of the page end row
variables.endRow = variables.startRow + attributes.recordsPerPage - 1;

//if the variables.endRow is greater than the recordcount, determine remining # of records
if (variables.endRow GTE attributes.queryrecordcount) {
variables.nextPage = 0;
variables.endRow = attributes.queryrecordcount;
}else{
//next page params...
//set the next x records value;
//if total Record Count minus last displayed record is less then recordsPerPage value, then set display next x records acordingly
if (variables.endRow + attributes.recordsPerPage GT attributes.queryrecordcount) {
variables.nextRecordSet = attributes.queryrecordcount - variables.endRow;
}else{
variables.nextRecordSet = attributes.recordsPerPage;
}
variables.nextPage = 1;
variables.nextPageStart = variables.endRow + 1;
}

//previous page params...
//if variables.startRow is 1, there cannot be previous page
if (variables.startRow LTE 1) {
variables.previousPage = 0;
}else{
//if variables.startRow is greater then 1, set the params for previous page...
variables.previousPage = 1;
variables.previousPageStart = attributes.startRow - attributes.recordsPerPage;
}
//scope the variables to be returned to the calling template
caller.variables.startRow = variables.startRow;
caller.variables.endRow = variables.endRow;

if (IsDefined(&quot;variables.nextRecordSet&quot;)) {
caller.variables.nextRecordSet = variables.nextRecordSet;
}

caller.variables.nextPage = variables.nextPage;
if (variables.nextPage) {
caller.variables.nextPageStart = variables.nextPageStart;
}

caller.variables.previousPage = variables.previousPage;
if (variables.previousPage) {
caller.variables.previousPageStart = variables.previousPageStart;
}

</cfscript> Sylvano
dsylvano@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top