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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to fill a page with <cfoutput>

Status
Not open for further replies.

shawntbanks

Programmer
Oct 29, 2003
48
CA
I am trying to gather information from a database and display it on a page. The problem being that I can Only get the data to display in on column, I want it to fill the page. I am tryng to display a picture with a name under it. On the page i would like to have between 3 and four columns wide and however long it needs to be. Any help would be appricated, thanks

Code Included code in red is the main code





<cfset Now_date = #dateformat (now(), &quot;yyyy-mm-dd&quot;)# >

<cfquery name=&quot;Get_Featured&quot; datasource=&quot;market&quot;>
select Picture1, itemname
from saleitem
where featured = '1' and (#CreateODBCDate(Now_date)# between begindate and enddate)
</cfquery>

<cfinclude template=&quot;Templates/Header_&_Sidebar_for_Main_Folder.cfm&quot;>
<td rowspan=&quot;2&quot; valign=&quot;top&quot; bgcolor=&quot;#FFFFFF&quot;>

<table><tr><td><font color=&quot;#669933&quot; size=&quot;4&quot; face=&quot;Georgia, Times New Roman, Times, serif&quot;><strong>Featured Items</strong></font>
</td></tr></table>
<table><cfoutput query=&quot;Get_Featured&quot;><tr><td width=&quot;200&quot;><div align=&quot;center&quot;><img src=&quot;sale_item_Images/#picture1#&quot; alt=&quot;Click on picture to see ad&quot; width=&quot;150&quot; height=&quot;100&quot; border=&quot;0&quot;></a><BR>
<font size=&quot;1&quot; face=&quot;Georgia, Times New Roman, Times, serif&quot;>#itemname#</font></div></td>
</tr></cfoutput></table>







</tr>
<tr>
<td background=&quot;images/top_space2.gif&quot;><img src=&quot;images/top_space2.gif&quot;></td>
</tr>
</table>
</td></tr>
</table>

</body>
</html>
 
Something like this should be what you're looking for:

<table>
<tr>
<td>
<font color=&quot;#669933&quot; size=&quot;4&quot; face=&quot;Georgia, Times New Roman, Times, serif&quot;><strong>Featured Items</strong></font>
</td>
</tr>
</table>
<table>
<tr>
<cfset Row = 0>
<cfoutput query=&quot;Get_Featured&quot;>
<cfset Row = (Row + 1)>
<td width=&quot;200&quot;>
<div align=&quot;center&quot;>
<img src=&quot;sale_item_Images/#picture1#&quot; alt=&quot;Click on picture to see ad&quot; width=&quot;150&quot; height=&quot;100&quot; border=&quot;0&quot;><BR>
<font size=&quot;1&quot; face=&quot;Georgia, Times New Roman, Times, serif&quot;>#itemname#</font>
</div>
</td>
<cfif Row EQ 3>
</tr>
<tr>
<cfset Row = 0>
</cfif>
</cfoutput>

</tr>
</table>

The output keeps replicating the <td></td> tags, after it outputs the 3rd <td></td>, it creates a new row and starts over. You can make it put out as many <td></td> as you want, just change the number value in the <cfif> statement to whatever number you want it output on each row.

Hope This Helps!

Ecobb

&quot;Alright Brain, you don't like me, and I don't like you. But lets just do this, and I can get back to killing you with beer.&quot; - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top