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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.