Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / November 2006



Tip: Looking for answers? Try searching our database.

cfoutput vs cfloop

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
elGrandeAdi - 25 Nov 2006 02:52 GMT
Hi all,

Ok, I was easily able to solve the problem, but logically, I don't understand
and I would appreciate if somebody could quickly explain this to me.

I'm using a a function that determines the size of an image. The size will
determine the size of a pop up window, when the thumbnail is clicked. So, I did
this:

<cfoutput query="whatsNewpaintingsThumb" maxrows="50">
  <cfif columnCount EQ 1>
      <tr>
  </cfif>                             
  <cfset lImageSize =
ImageSize("D:\xxx\xxx\images\paintings\#paintingImgLarge#")>
  <td>
      <a href="##"
onclick="MM_openBrWindow('wNewPaintingPopup.cfm?id=#id#','','width=#lImageSize.I
mageWidth#,height=#lImageSize.ImageHeight#')"><img
src="images/paintings/#paintingImgTiny#" border="0" /></a>
  </td>                      
  <cfset columnCount = #columnCount# + 1>
  <cfif columnCount EQ 5>
      </tr>
      <cfset columnCount = 1>
  </cfif>
</cfoutput>

When processing the query, the first query result (row) runs through without a
problem. On the second result the code brakes though, with an error mentioning
something about invalid symbols for the function. When I do the same thing with
a loop it all works properly.

<cfoutput>
  <cfloop query="whatsNewpaintingsThumb" endrow="50">
      <cfif columnCount EQ 1>
          <tr>
      </cfif>                             
     <cfset lImageSize =
ImageSize("D:\inetpub\japingka\images\paintings\#paintingImgLarge#")>
     <td>
          <a href="##"
onclick="MM_openBrWindow('wNewPaintingPopup.cfm?id=#id#','','width=#lImageSize.I
mageWidth#,height=#lImageSize.ImageHeight#')"><img
src="images/paintings/#paintingImgTiny#" border="0" /></a>
      </td>                      
      <cfset columnCount = #columnCount# + 1>
      <cfif columnCount EQ 5>
          </tr>
         <cfset columnCount = 1>
     </cfif>       
  </cfloop>
</cfoutput>

Now, I did read during my investigation that the setting of the variable

     <cfset lImageSize =
ImageSize("D:\inetpub\japingka\images\paintings\#paintingImgLarge#")>

will in the cfoutput fail. But it wasn't really mentioned why. So, ahm, can
somebody explain this to me? I'd just like to understand.

Thanks
Adrian
Adam Cameron - 25 Nov 2006 10:03 GMT
> with an error mentioning
> something about invalid symbols for the function.

This is a bit vague.  That is the EXACT error msg, and on what line?
That's usually a good hint as to what's going wrong, I find.

Signature

Adam

garyrgi - 27 Nov 2006 19:35 GMT
ElGrandeAdi,

Is the code you pasted exact?  or did you replace some key things to obfuscate?

This is in your cfoutput:
[Q]<cfset lImageSize =
ImageSize("D:\xxx\xxx\images\paintings\#paintingImgLarge#")>[/Q]
This is in your cfloop:
[Q]<cfset lImageSize =
ImageSize("D:\inetpub\japingka\images\paintings\#paintingImgLarge#")>[/Q]
If this is your actual code obviously your imageSize function is not going to
be able to find the directory xxx\xxxx unless of course they do exist?

Regards,

Gary
elGrandeAdi - 28 Nov 2006 05:33 GMT
Yeah, I tried to obfuscate...but obviously not consequently enough. ;)

I don't have the error message anymore, as I basically fixed the problem. I'll recreate and post it later.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.