echo out the date of page was created
Permalink
Hello. So im working with the page list in concrete5 and i need to echo out the date of when i add the page. i try to put in this code, which works, but this only display the time current, so next time i log in the time stamp has changed.
then i try put in this code instead, but then i get an error and im not sure what im missing :-/ Any help is appreciated.
i get this error:
Fatal error: Call to a member function getCollectionDateAdded() on a non-object in /var.....line57
<?php $date = Loader::helper("date"); echo $date->getLocalDateTime('now',$mask = 'd - M / Y') ?>
then i try put in this code instead, but then i get an error and im not sure what im missing :-/ Any help is appreciated.
<?php echo $c->getCollectionDateAdded('F j, Y') ?>
i get this error:
Fatal error: Call to a member function getCollectionDateAdded() on a non-object in /var.....line57
<?php $c = Page::getCurrentPage(); echo $c->getCollectionDateAdded('F j, Y') ?>
This code makes it get the date from the HOME page - i need it to echo out the dates from when i created the subpages to the home page. Like this is my sitemap:
HOME
- websites
-- page to website (i need date from this page)
- design
-- page to design (i need date from this page)
Any idea on what i should type instead ?
thx
Something like this:
$date = $c->getCollectionDatePublic('F j, Y'); echo $date;
that give me this error:
Fatal error: Call to a member function getCollectionDatePublic() on a non-object in /var... on line 57
Fatal error: Call to a member function getCollectionDatePublic() on a non-object in /var... on line 57
did you ever get through with this - im tryin to do the same
Are you modifying or creating your own Page List template? If so, in the original view.php in the core page list files, you will see that there is a 'foreach' statement collecting the data for each page to be displayed.
So, you could add to that...
Then in the html part of the 'foreach' where it echo's the url, target, title and description, you could have it echo the $datePublic.
That should give you the date each page in the page list was created.
So, you could add to that...
Then in the html part of the 'foreach' where it echo's the url, target, title and description, you could have it echo the $datePublic.
That should give you the date each page in the page list was created.
wow thanks for quick repsonse
It works - I now have dates in my page list thanks
It works - I now have dates in my page list thanks
I was getting the same error message and your suggestion got rid of the error message, but the date still isn't showing up. If you are still monitoring this post, would you mind helping me out?
I tried the code exactly as you posted above, and then
[$date = date(DATE_APP_GENERIC_MDY_FULL, strtotime($page->getCollectionDatePublic()))].
It seems the original error was from
[$dh->date].
Should this be referenced somewhere else that I don't know about?
I tried the code exactly as you posted above, and then
[$date = date(DATE_APP_GENERIC_MDY_FULL, strtotime($page->getCollectionDatePublic()))].
It seems the original error was from
[$dh->date].
Should this be referenced somewhere else that I don't know about?
Hi
Just need to add echo to this to make it print out the date:
<?php $datePublic = date('F j, Y', strtotime($page->getCollectionDatePublic())); echo $datePublic ?>
Just need to add echo to this to make it print out the date:
<?php $datePublic = date('F j, Y', strtotime($page->getCollectionDatePublic())); echo $datePublic ?>
$c = Page::getCurrentPage();
thats the first thing i would try. the error indicates that $c isn't initialized anywhere (or at least not to an object). So i would look for where you are doing that, or where it should be done and make sure it happens