Forum Moderators: phranque

Message Too Old, No Replies

ColdFusion Code - Need Help!

Need Help with Simple ColdFusion Edit

         

AIDSorg

9:22 pm on Aug 18, 2005 (gmt 0)

10+ Year Member



As a novice to ColdFusion, I need some help adjusting this code to make it work properly on our site. I tried commenting out the <cfelse>, but that didn't solve the problem either. Here's the small piece of code:

<cfif DateDiff('d',atnArticle.dt,Now()) gt 365*2>
<a href="../atnSupport/search.cfm"><img src="../atnImages/atnWarn.gif" border="0"></a>
<cfelse>
<img src="../atnImages/atnLogo.gif" border="0"><br><!-- #BeginLibraryItem "/Library/sendatn.lbi" -->

<CFELSE> indicates to only execute sendatn.lbi IF the article is greater than 2 years old.

WHAT I NEED: if article is greater than 2 years old, then it displays atnWarn.gif. BUT ALSO, I need for sendatn.lbi be available on ALL pages - and not just those 2 years old.

Can someone possibly help me out quickly?

Thanks,
//Gary

txbakers

9:04 pm on Aug 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



bump

XtendScott

2:58 am on Sep 13, 2005 (gmt 0)

10+ Year Member



<!-- set value for date -->
<cfset atnArticle.dt = "9/12/2002 10:15:28 PM">

<cfif DateDiff('d',atnArticle.dt,Now()) gt 365*2>
<!-- Use this if older than 2 years -->
<a href="../atnSupport/search.cfm"><img src="../atnImages/atnWarn.gif" border="0">Warning!</a>
<cfelse>
<!-- Use this if within 2 years -->
<img src="../atnImages/atnLogo.gif" border="0">! OK!<br><!-- #BeginLibraryItem "/Library/sendatn.lbi" -->
</cfif>

Not sure if you got it working but you were close, not sure if the library item is supposed to be used if the article is older than two years. IF so the library item needs to be before the <cfelse>.

The way it is coded is IF older than 2 years do warning ELSE do atnLogo.gif and Library Item.

Hope this helps.

XtendScott