How to display page creation date next to page title in Auto-Navs

We have been wanting to display the date that a page was created (public date) next to the page title in Auto-Navs, or something similar. The time that the page was created is not necessary; in fact, we'd prefer to just echo the date. The reason for this is that we have a blog archive page, and there are many blogs under any given date, and it would very much help with organization if we were able to display the date and title of each blog post (see example at
Any help in this matter would be greatly appreciated.
Thanks! :)

View Replies: View Best Answer
joseajohnson replied on at Permalink Reply
Sounds like you need a template modification; it would be easier to be more specific with your current autonav template in hand, but something like this is probably what your after -

$aBlocks = $controller->generateNav();
   foreach($aBlocks as $ni) {
      $_c = $ni->getCollectionObject();
      $myDateAdded = $_c->getCollectionDateAdded('jS \of F Y');
      echo('<a href="' . $ni->getURL() . '">' . $myDateAdded . ' ' . $ni->getName() . '</a>');

Valid values for the getCollectionDateAdded mask can be found here.

You can attach your template file to a forum post!

Cheers -
dsw528 replied on at Permalink Reply
This sounds like it is what we're looking for, but I have a couple questions.
Is this code supposed to be put into a custom template for the autonav block under /blocks/autonav/templates/my_template?
Also, if it is, where do I put this code? Do I just copy the default view.php for the autonav and replace a section of code in there with this code in the custom template?

Edit: Also, did you mean you wanted me to attach my autonav template to this post? All I'm using is the default view.php template for the default autonav block in Concrete5. The code is below:

   defined('C5_EXECUTE') or die("Access Denied.");
   $aBlocks = $controller->generateNav();
   $c = Page::getCurrentPage();
   $containsPages = false;
   $nh = Loader::helper('navigation');
   //this will create an array of parent cIDs 
   $selectedPathCIDs=array( $inspectC->getCollectionID() );
joseajohnson replied on at Permalink Reply 1 Attachment
Here's a modified template you can install like any other package.

Just upload to /packages and it should appear in your install dashboard page.

If you want to change the way the date is displayed, line 6 of the view.php contains the mask.

Let me know if this works out for you -

Good Luck!
dsw528 replied on at Permalink Reply
This is very close to what we're looking for, but for some reason it seems to be echoing the date the page was actually created, as opposed to the date/time we set for it.
We are in the process of transferring several blogs from an old site to a new site, so we are adding many blogs in a day that were actually added a long time ago, so we have to set the date of the page to be that of the actual post. It looks like this is the Public Date / Time? Is there a quick and easy way to fix this?
Thank you very much for the template, by the way! :)
pvernaglia replied on at Permalink Reply
Try using getCollectionDatePublic
dsw528 replied on at Permalink Reply
Do I replace it in both places that getCollectionDateAdded appears? Or just one?
joseajohnson replied on at Permalink Best Answer Reply 1 Attachment
pvernaglia is right: from within the view.php file, change the following on lines 61 and 67 from



or, just update (upload and update from the dashboard) the package with this one.

Not sure which will turn out to be quickest or easiest ;)
dsw528 replied on at Permalink Reply
It worked perfectly!
Thank you so much, this helped us out tremendously!

You would think it would be a little easier to extract something like the Date a page was created (or in this case the Public Date), lol. Is this the way all of this kind of stuff has to be done?

Thank you again! :)