Link to home
Start Free TrialLog in
Avatar of Dusty
DustyFlag for United States of America

asked on

CFML question/problem with using cfdirectory

This should be simple, and I'm sure it is :)  What I'm trying to accomplish is output a query of similar homes with photo, and if the property does not yet have a photo, display the no-photo.png graphic instead of a broken photo link.


====================================================================
<cfoutput query="similarhomes">
<cfif similarhomes.RecordCount EQ 0 OR similarhomes.subdivision IS "none"><cfelse>

<a href="/#urlencodedformat(trim(ListID))#/#StrNumber#-#StrName#-#Cty#-#St#.html" target="_blank">


<cfdirectory action="list" directory="#ExpandPath('/ftp/pics/')#" filter="#variables.IDnumber#.jpg" name="similarpics">
              <cfif similarpics.recordCount eq 0><img src="/images/no-photo.png" height="90" alt="no-photo" class="left" /><cfelse>

<img src="/ftp/pics/#ListID#.jpg" alt="#StreetNumber# #StreetName# #City# GA" width="130" height="90" class="left" /></cfif>

<h4>#StreetNumber# #StreetName#</a>
<br />
#City#, #State#</h4>
<br />
Price: #RemoveChars(DollarFormat(Price),Len(DollarFormat(Price))-3,3)#
<br />
SqFt: #TotalFinishedSQFT#
<br />
Bedrooms: #Bedrooms#
<br /><br />

 <hr />
 </cfif>
 </cfoutput>

================================================================
An example page where I'm running this code is at:http://199.73.57.154/103862/306-Estates-Way-Warner-Robins-GA.html the photos show up on the right column under "Similar Homes" the code above works as long as there is an existing photo, but still just shows a broken photo link if there is no photo.

As always, any help is greatly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dusty

ASKER

Perfect! thanks!