Quantcast
Viewing all articles
Browse latest Browse all 21760

cfloop w/ FileExists, color coding presence or not

Hello,

 

CF Version: 8

 

I have fifty(50) records returned with the query below. I want to loop through those

records to see if the associated file actually exists on the server. If the file does

exist then display the file name in green text if it does not then display in red.

 

My current code picks up that the first file does exist and sets the color to green

as well as all the rest of the document information. I know for a fact that some of

the documents are missing, so some of the documents names should be displaying

in red. The output is correctly displaying all the records, just not changing colors

respectfully to the presence of the file.

 

What am I doing wrong? Am I going about this all wrong?

 

<cfloop query="rsDocuments">

<cfoutput>

<div style="margin-bottom: 15px;">

#disp_title#<br />

<cfif FileExists(#FilePath#)>

<span style="color: ##093;">#doc_file#</span>

<cfelse>

<span style="color: ##F00;">#doc_file#</span>

</cfif>

</div>

</cfoutput>

</cfloop>

 

Thanks in advance for insight.

 

Leonard B


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>