icon:
function Image(filename){
var ext = "";
var img = "empty";
if(ListLen(filename,".") GT 1) ext = ListLast(filename,".");
else if(ListFindNoCase("doc,rtf",ext)) img = "doc";
else if(ListFindNoCase("xls,csv",ext)) img = "xls";
else if(ListFindNoCase("ppt",ext)) img = "ppt";
else if(ListFindNoCase("mdb",ext)) img = "mdb";
else if(ListFindNoCase("pdf",ext)) img = "pdf";
else if(ListFindNoCase("zip",ext)) img = "zip";
else if(ListFindNoCase("mp3",ext)) img = "mp3";
else if(ListFindNoCase("gif,png",ext)) img = "gif";
else if(ListFindNoCase("jpg,jpeg",ext)) img = "jpeg";
else if(ListFindNoCase("txt",ext)) img = "txt";
else if(ListFindNoCase("htm,html",ext)) img = "html";
return img & ".gif";
}
> -----Original Message-----
> From: Ian Vaughan [mailto:[EMAIL PROTECTED]
> Sent: 06 August 2004 10:56
> To: CF-Talk
> Subject: Rules based output in Coldfusion ?
>
> 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]

