Solved

Wanna Create a TD based on Coldfusion

Posted on 2009-07-11
3
164 Views
Last Modified: 2013-12-24
Hi experts, I have many as 10 images and i want all the images appear in 5 in one row. i am really out done how i do.

Please can someone correct my code:
<cfif DirectoryExists("#ExpandPath("images/#username#/watermarked")#")>

     <cfdirectory action="list" directory="#ExpandPath("images/#username#/watermarked")#" name="showall">

	<cfset dirsArray=arraynew(1)>

	<cfset i=1>

    <cfloop query="showall">

    <cfif showall.type IS "file">

    <cfset dirsArray[i]=showall.name>

    <cfset i = i + 1>

    </cfif>

    </cfloop>

    <cfset variables.newrow = False>

     <table border="1">

     <cfloop from="1" to="#ArrayLen(dirsArray)#" index="i">

     <cfoutput>

     

            <cfif variables.newrow EQ true>

              <tr>

            </cfif>

            <td><input type="radio" name="oldimage#i#" value="#dirsArray[i]#" /><strong>

     <img src="images/#GetA.username#/watermarked/#dirsArray[i]#" border="0" width="100" height="100" /></strong>

     </td>

            <cfif showall.currentRow MOD 3 EQ 0>

              </tr>

              <cfset variables.newrow = true>

              <cfelse>

              <cfset variables.newrow = false>

            </cfif>    

     

     </cfoutput>

     </cfloop>

     </table>        

     </cfif>

Open in new window

0
Comment
  • 2
3 Comments
 
LVL 13

Expert Comment

by:srikanthmadishetti
ID: 24831588
see this example


<cfset test = "a,b,c,d,e,f,g,h,i,j">
<cfoutput>

<table width="100%" border="1">
<tr>
<cfset count = 1>
<cfloop list="#test#" index="i">
<td>
#i#  #listlen(test) mod 5#
</td>
<cfif count mod 5 eq 0>
</tr>
<tr>
</cfif>

<cfif count eq  listlen(test)>
</tr>
</cfif>

<cfset count = count +1>
</cfloop>

</table>
</cfoutput>

in the above example i used list instead of query

you can use queryname.recordcount  instead of listlen(test) and insetad of coutn you can use currentrow.
0
 
LVL 13

Accepted Solution

by:
srikanthmadishetti earned 500 total points
ID: 24831701
I have modifed didn't tested but it should work .

Let me know if u have any props.

 <cfoutput>
<cfif DirectoryExists("#ExpandPath("images/#username#/watermarked")#")>
     <cfdirectory action="list" directory="#ExpandPath("images/#username#/watermarked")#" name="showall">
        <cfset dirsArray=arraynew(1)>
        <cfset i=1>
    <cfloop query="showall">
    <cfif showall.type IS "file">
    <cfset dirsArray[i]=showall.name>
    <cfset i = i + 1>
    </cfif>
    </cfloop>
 
     <table border="1">
      <tr>
     <cfloop from="1" to="#ArrayLen(dirsArray)#" index="i">
    <td><input type="radio" name="oldimage#i#" value="#dirsArray[i]#" /><strong>
     <img src="images/#GetA.username#/watermarked/#dirsArray[i]#" border="0" width="100" height="100" /></strong>
     </td>
 <cfif i mod 5 eq 0>
</tr>
<tr>
</cfif>
     
     <cfif i eq  ArrayLen(dirsArray)>
</tr>
</cfif>
 
     </cfloop>
     </table>        
     </cfif>
     
         </cfoutput>
0
 
LVL 15

Author Closing Comment

by:Gurpreet Singh Randhawa
ID: 31602450
Worked Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now