Thank you everyone, this is great stuff, as usual.  I haven't played around
with UDF's very much, and I should have. 

You've all given me some good lines to follow. I'm sure I'll have it done
this evening. 

And thanks Elliot - Good to hear from you again.

Cheers
Mike Kear
Windsor, NSW, Australia
AFP Webworks
http://afpwebworks.com



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Elliot Russo
Sent: Monday, 15 March 2004 5:13 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Need help with a UDF please ....

Hi Mike,

UDF can access any shared scope variables ie, session, application, request,
client etc - but usually better to loosely couple by passing in everything
you need as arguments to the function - makes it more reusable om om om om.
Sorry got carried away with the mantra for a moment.

<cffunction name="showGraphic">

 <cfargument name="LastLoginDate"  type="date" />
 <cfargument name="Created"    type="date" />
 <cfargument name="LastModified"  type="date" />

 <cfset var sImage = "" />

 <cfif LastLoginDate lt Created>
  <cfset sImage = "<img src='new.gif'>" />
 <cfelseif LastLoginDate lt LastModified>
  <cfset var sImage = "<img src='updated.gif'>" />
 </cfif>

 <cfreturn sImage />

</cffunction>

<cfloop query="qArticles">

 <cfoutput><p>#showGraphic(session.auth.LastLoginDate, Created,
LastModified)# #Title#</p></cfoutput>

</cfloop>


Can use a good old custom tag for this too.




---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to