SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Date Appear Once

    Hi guys, can I know the logic behind most news sites on how they make their date appear only once a day instead of in every news post?

    Thanks for your help.

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a variable, e.g. $cur_date, set it to the date of the first news post, then loop through all news post and if, and only if, the date of a post != $cur_date, update the value and print the new date?

  3. #3
    SitePoint Guru GamerZ's Avatar
    Join Date
    Nov 2001
    Location
    Singapore
    Posts
    617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jofa
    Use a variable, e.g. $cur_date, set it to the date of the first news post, then loop through all news post and if, and only if, the date of a post != $cur_date, update the value and print the new date?
    thanks =D. It work like a charm


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •