1. Welcome! Please take a few seconds to create your free account to post threads, make some friends, remove a few ads while surfing and much more. ClutchFans has been bringing fans together to talk Houston Sports since 1996. Join us!

Any PHP gurus on this board?

Discussion in 'BBS Hangout' started by what, Apr 28, 2014.

Tags:
  1. what

    what Member

    Joined:
    Dec 4, 2003
    Messages:
    14,727
    Likes Received:
    2,653
    I am trying to create a function that would return the DAY a post was created. Also, I would like a similar function that would return the Month a post was created.

    I am using www.anchorcms.com, if that makes a difference. In the docs, they include a function that returns a UNIX timestamp. Look:

    article_time()

    Returns a UNIX timestamp from when the post was added, which can be used to add custom timestamps. If you want to use the default timestamp, use article_date() instead.
     
  2. heypartner

    heypartner Member

    Joined:
    Oct 27, 1999
    Messages:
    64,080
    Likes Received:
    60,108
    this is more a database question than a language question. what database stores the posts.
     
  3. what

    what Member

    Joined:
    Dec 4, 2003
    Messages:
    14,727
    Likes Received:
    2,653
    It's mysql.

    by the way, will this do what i want?

    function article_day() {
    if($created = Registry:: prop('article', 'created')) {
    return Date::format($created, 'd');
    }
    }
     
  4. heypartner

    heypartner Member

    Joined:
    Oct 27, 1999
    Messages:
    64,080
    Likes Received:
    60,108
    yes, that should work. But note, this is really an anchor-cms question. Each CMS could do things differently. The answer is likely specific to the implementation of anchor-cms. It is using the Registry framework, and describes pages as "article"s. As soon as you showed that, i'm fairly confident your code should work.
     

Share This Page