echo out the date of page was created
<?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
$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
<?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:
-- page to website (i need date from this page)
-- page to design (i need date from this page)
Any idea on what i should type instead ?
$date = $c->getCollectionDatePublic('F j, Y'); echo $date;
Fatal error: Call to a member function getCollectionDatePublic() on a non-object in /var... on line 57
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.
It works - I now have dates in my page list thanks
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
Should this be referenced somewhere else that I don't know about?
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 ?>