Jump to content

Php New Post


jduffell

Recommended Posts

Hi, it's either going to be complicated or easy, but i'm trying to find a script which will add an image after a link to represent a new post.

 

I'm basically using a database to store links which are then displayed in alphabetic order, and when i add a new link to the database i want an image to appear next to the link for a week after it's posted and then it's removed.

 

Any help welcome, cheers

Link to comment
https://forums.phpfreaks.com/topic/106504-php-new-post/
Share on other sites

I would use CSS to make the image part of the link, like this:

 

<style type="text/css">
a.new {
background: transparent url("path_to_small_image") no-repeat center right;
padding-right: 20px;
}
</style>

<a class="new" href="">Link</a>

 

And if your page is viewed even just once a day, you won't need a cron job. Just store a timestamp or date along with the link, and check how old it is when echoing it.

Link to comment
https://forums.phpfreaks.com/topic/106504-php-new-post/#findComment-545929
Share on other sites

Store a "last edited" timestamp along with the list. (Make it when the thread is created, then update whenever there's a post/edit

 

Then when you show the threads, simply do

print $name; if($last_edited > ($now - 60200)) { print "image tag"; }

 

(Make $now = time(); somewhere above, I tend to define it on page load)

Link to comment
https://forums.phpfreaks.com/topic/106504-php-new-post/#findComment-545941
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.