Yep - UDFs can access session data - or you could do it kinda like this:
<cffunction name="displayDocImage" output="yes">
<cfargument name="loginDate" type="date" required="yes">
<cfargument name="documentDate" type="date" required="yes">
<cfif DateCompare(arguments.loginDate, arguments.documentDate) eq -1>
<img src="new.gif">
<cfelse>
<img src="updated.gif">
</cfif>
</cffunction>
<!---
example call
- assumed #documentDate# grabbed from a record somewhere.
--->
<cfoutput>
<p>
#displayDocImage(session.auth.lastLogin, #documentDate#)# My Document
</p>
</cfoutput>
That make sense?
Mark
------------------------------------------------------------------
[EMAIL PROTECTED]
ICQ: 3094740
Safe From Bees
[ www.safefrombees.com ]
Quoting Michael Kear <[EMAIL PROTECTED]>:
> Thanks Mark, that's the easy bit. I'm wondering about how I pass the
> session.auth.lastlogin date to the UDF, given that each user on the site
> will have a different last login date.
>
> Or can UDFs just access the session variables the same way the main page
> can?
>
> What the function has to do is figure out whether this article is new or
> updated FOR THIS USER since they were last here. I have the user's
> lastlogin date, and I have a date added (i.e. NEW date) and dateupdated
> (i.e. last changed) date, so using those three dates I can work it out, but
> I don't want to have to put all this in dozens of places on the site:
>
> [pseudocode]
> If session.auth.lastlogin is less than document.dateadded - show NEW.GIF
> IF session.auth.lastlogin is greater than document.dateadded and less than
> document.dateupdated - show UPDATED.GIF
> Else - show nothing.
> [/pseudocode]
>
> Cheers
> Mike Kear
> Windsor, NSW, Australia
> AFP Webworks
> http://afpwebworks.com
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark M
> Sent: Monday, 15 March 2004 4:23 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: Need help with a UDF please ....
>
> Assumig you have a date for when the document was submitted, you can use a
> DateCompare
> (date1, date2) to decide which one you wish to display.
>
>
> Or is there something I'm missing here?
>
> Mark
> ------------------------------------------------------------------
> [EMAIL PROTECTED]
> ICQ: 3094740
> Safe From Bees
> [ www.safefrombees.com ]
>
>
> Quoting Michael Kear <[EMAIL PROTECTED]>:
>
> > I have a need to write a UDF (or another concise way to use functionality)
> > to do the following:
> >
> > I have a session.auth.lastlogin field in the session vars to tell me when
> > the user was last here, and I have a field Dateadded and Dateupdated in
> > every document, and I want to put a little "NEW" graphic or "UPDATED"
> > graphic next to each article in a documents list if it's been added or
> > changed since the user was last here. Also at the head of the document
> when
> > the user looks through the site. SO it's going to be used often.
> >
> > I want to be able to put in the code something like this:
> >
> > <cfif Isnew(docID)><img src="new.gif"></cfif> #documents.title#
> >
> > How would I write a UDF to tell CF whether to add a "new.gif" or
> > "updated.gif" or have no graphic (if the document is unchanged since the
> > user was last here)?
> >
> > I have been reading up on writing UDFs, but none seem to show me how to
> > include both the session variable and the document ID in the functionality
> > here.
> >
> > Cheers
> > Mike Kear
> > Windsor, NSW, Australia
> > AFP Webworks
> > http://afpwebworks.com
> >
> >
> >
> >
> >
> > ---
> > 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
> >
> >
> >
>
> ---
> 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
>
>
>
> ---
> 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
>
>
>
---
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