Jump to content

->date deprecated?


Martin Muzatko
 Share

Recommended Posts

I tried to create a very minimalistic news system.

When I found this here: http://processwire.com/api/templates/

<ul>
<?php

$features = $pages->find("template=press_release, featured=1, limit=3, sort=-date");
foreach($features as $feature) {
   echo "<li>" . 
        "<h3><a href='{$feature->url}'>{$feature->title}</a></h3>" . 
        "<span class='date'>{$feature->date}</span>" . 
        "<p>{$feature->summary}</p>" . 
        "</li>";
 
}
?></ul>

Do I actually need a field called date, or can I access the creationdate without creating one?
I'd like to find some wikipages regarding that topic. Default fields that are always accessible.

Thanks in advance!

Link to comment
Share on other sites

Welcome to PW and the forums Misan..

Have a read here for all $page properties and methods: http://processwire.com/api/variables/page/

What you want is $page->created: Unix timestamp of when the page was created or 'created' if in a selector

Related -  $page->modified: Unix timestamp of when the page was last modified

Also useful to read about $pages: http://processwire.com/api/variables/pages/

Edited by kongondo
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...