How could I display an icon based on the suffix of a file in Coldfusion
?


For example from the following output from a cfquery


<a  href=""> <http://intranet.neath-porttalbot.gov.uk/itintranet/itdocuments/document
s/#docpath#">#doctitle#</a> >


If the file name in docpath was for example sample.pdf - a PDF icon
would display next to the doctitle


If the file name in docpath was sample.doc - a MS Word icon would
display next to the doctitle etc


How would this be achieved in Coldfusion using by using CFIF below ??


<cfif getdocs.docpath EQ ".pdf">
<a  href=""> <http://intranet.neath-porttalbot.gov.uk/itintranet/itdocuments/document
s/#docpath#">#doctitle#</a> >
<img border="0" src=""> <http://intranet.neath-porttalbot.gov.uk/images/icons/pdficon.gif> "
width="32" height="33">


<cfelseif getdocs.docpath EQ ".doc">
<a  href=""> <http://intranet.neath-porttalbot.gov.uk/itintranet/itdocuments/document
s/#docpath#">#doctitle#</a> >
<img border="0" src=""> <http://intranet.neath-porttalbot.gov.uk/images/icons/pdficon.gif> "
width="32" height="33">


</cfif>

or is there a more efficient approach ?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to