How to display page creation date next to page title in Auto-Navs
Permalink
Hello.
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 athttp://gods-kingdom-ministries.net/daily-weblogs/2012/)....
Any help in this matter would be greatly appreciated.
Thanks! :)
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 athttp://gods-kingdom-ministries.net/daily-weblogs/2012/)....
Any help in this matter would be greatly appreciated.
Thanks! :)
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:
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:
<?php 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 $inspectC=$c; $selectedPathCIDs=array( $inspectC->getCollectionID() ); $parentCIDnotZero=true; while($parentCIDnotZero){ $cParentID=$inspectC->cParentID; if(!intval($cParentID)){ $parentCIDnotZero=false; }else{
Viewing 15 lines of 73 lines. View entire code block.
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!
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!
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! :)
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! :)
Try using getCollectionDatePublic
Do I replace it in both places that getCollectionDateAdded appears? Or just one?
pvernaglia is right: from within the view.php file, change the following on lines 61 and 67 from
to
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 ;)
getCollectionDateAdded
to
getCollectionDatePublic
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 ;)
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! :)
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! :)
Valid values for the getCollectionDateAdded mask can be found here.
http://php.net/manual/en/function.date.php...
You can attach your template file to a forum post!
Cheers -