user1070143
user1070143

Reputation: 427

How to return the most recent channel entry/comment date?

To be honest I'm not expecting an answer to this question. While it sounds simple, I think it's probably quite involved.

For a given channel I want to return one date/time - it will be either the latest channel entry date or the most recent comment date, whichever is the most recent date/time.

Cheers Lee

Upvotes: 2

Views: 154

Answers (3)

Steven Hambleton
Steven Hambleton

Reputation: 53

You can try using the IfElse plugin to make sure you don't output the IfElse conditional.

Upvotes: 4

Jason Varga
Jason Varga

Reputation: 1959

You can use the Statistics Module (as John said) but the following code will output either the comment or entry data like you requested:

{exp:stats}
  {if last_comment_date > last_entry_date}
    {!-- Comment is more recent --}
    {last_comment_date format="..."}
  {if:else}
    {!-- Entry is more recent --}
    {last_entry_date format="..."}
  {/if}
{/exp:stats}

Upvotes: 2

John Henry Donovan
John Henry Donovan

Reputation: 351

Use the Stats Module here to return the required data

http://expressionengine.com/user_guide/modules/statistics/index.html#variables

{exp:stats}
            Last Comment Date : {last_comment_date format="%m/%d/%Y %h:%i %a"}
            Last Entry Date : {last_entry_date format="%m/%d/%Y %h:%i %a"}
    {/exp:stats}

Upvotes: 6

Related Questions