Solved

Showing user an image dynamically for a day?

Posted on 2004-08-10
6
141 Views
Last Modified: 2013-12-24
Hi,

I wanted to see if someone can help with this issue.

I wanted to add this small feature for our site.  Basically when a user creates a new document in our web based app, we show the user a list of the documents associated with their account in a nice html table.  Their documents are listed as hyperlinks.

I want to display a simple image on my page that has the words "new" on it next to the hyperlink if the document was created "today".  So for the whole day the user would see the *New* image next to the hyperlink.

The next day when the user logs in, the new image would be gone as it would be the next day.

How can I accomplish this?  Does it involve client variables or would it be done through a cookie?  If user does not accept cookies, what alternatives are there?  It is my understanding that client variables compare the information from a db or a registry to a cookie on the users machine so if the user does not have cookies enabled, what does the client var in our db compare itself to???

Thanks,

West



0
Comment
Question by:Westside2004
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:Seth_Bienek
ID: 11767966

Hey West,

All you need is the age of the document.

Wether it's a file or a record in a database, there should be a date associated with it's creation.  Use that date to determine wether the 'new' graphic gets displayed or not:

<cfif datediff(userdocument.date_added, now()) LTE 0><img src="/images/new.gif"></cfif>

Something like that.

Regards,

Seth
0
 
LVL 1

Author Comment

by:Westside2004
ID: 11768205
Yes, that makes sense..

Will try what you gave me..

I am basically looking to show the image if the document is 6 hours old or less, if so, mark it new by showing the new img

Otherwise, don't show any image at all..

Thanks

-West
0
 
LVL 5

Accepted Solution

by:
Seth_Bienek earned 125 total points
ID: 11768239

I was just looking at the code I posted.  I don't know what I was thinking about, but the syntax is wrong.

Should have been:

<cfif datediff("h", userdocument.date_added, now()) GTE 6><img src="/images/new.gif"></cfif>

Regards,

Seth
0
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 
LVL 1

Author Comment

by:Westside2004
ID: 11768397
HI,

Will try it now..

What is the "h"?
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11768471
Hi Westside2004,
seth has good suggestion. h stands for hour. As you are looking for six hours difference.

Regards,
---Pinal
0
 
LVL 1

Author Comment

by:Westside2004
ID: 11779314
Ok..

I thought that... but wanted to just make sure...

Thanks

-Westside
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question