Page List Teasers AddOn - Get Date of Child Page?
Permalink 1 user found helpful
Hi All,
How do I get the date of the child page when using the page list teasers custom template for the page list block?
Thanks
Dave
How do I get the date of the child page when using the page list teasers custom template for the page list block?
Thanks
Dave
Thanks for your reply Irsah.
I have something similar already in my copy of the page list teaser file:
But this just shows the date of the parent page for each article - not the date of the child page.
I have something similar already in my copy of the page list teaser file:
<div class="news-article"> <h3 class="ccm-page-list-title"><a <?php echo $target?>href="<?php echo $nh->getLinkToCollection($cobj)?>"><?php echo $title?></a></h3> <?php $date = date('F j, Y', strtotime($page->getCollectionDatePublic())); ?> <div class="post-date"><?php echo $date; ?></div> <div class="ccm-page-list-description"> <?php $plth->output_page_blocks($cobj, $excerptBlocks, $truncateChars); ?> </div> <a href="<?php echo $nh->getLinkToCollection($cobj)?>" class="read-article">Read Article</a> </div>
But this just shows the date of the parent page for each article - not the date of the child page.
Oh got it.. I have it somewhere and i'll keep you posted asap.
You're a star, thanks! :)
Look thru your code, there were corrections have to be made for getting the date/links/title/description for each page before calling it in the html markup (array of pages). It's much easier and cleaner :-) hope it worked out.
Your welcome Dave.
Your welcome Dave.
I get syntax errors when I put your code in, do you have a complete example of the teasers page?
Ok i'll send it thru attachment.
Here's the file. Syntax error probably occurs because rss/pagination was loaded but you can un select in the front end options to do not want to display them.
Thanks although now I get
Sorry not a developer so not sure if this is an easy fix or not?
Fatal error: Call to undefined method PageListTeasersHelper::getPageTeaser() in path-to-site\httpdocs\packages\page_list_teasers\blocks\page_list\templates\news_list.php on line 17
Sorry not a developer so not sure if this is an easy fix or not?
Ok I see, because the page_list teaser add on is using its own helpers. My bad.
Do you have the original teaser.php file in packages/page_list_teaser/blocks/page_list/templates/ folder?
Copy that file and rename it and paste in the same folder above. Edit and add in the additional code like " $date=... " and the marked html code for echoing the date in that new file.
I'll try to update the attachment for you later.
*edit* Updated attachment, just download, rename the file ie new_teaser.php and upload that file in your_root/packages/page_list_teaser/blocks/page_list/templates/ folder.
Incl image for the working page_list teaser with date using the above attached file.
Do you have the original teaser.php file in packages/page_list_teaser/blocks/page_list/templates/ folder?
Copy that file and rename it and paste in the same folder above. Edit and add in the additional code like " $date=... " and the marked html code for echoing the date in that new file.
I'll try to update the attachment for you later.
*edit* Updated attachment, just download, rename the file ie new_teaser.php and upload that file in your_root/packages/page_list_teaser/blocks/page_list/templates/ folder.
Incl image for the working page_list teaser with date using the above attached file.
I think I have done all that already.
If you get a chance later to update the attachment I would be most grateful :)
If you get a chance later to update the attachment I would be most grateful :)
Did you manage to find the code in the end? :)
It's in the same file attached previously. I've also attached an image which shows the output from the page_list teaser block thru that code.
Hope it helps
Hope it helps
I think it's in public_html/packages/page_list_teaser/blocks/page_list/templates/teaser.php
Of course best to copy that file and create a new template in your_root/blocks/page_list/templates/your_new_pagelist_teaser/view.php whereas view.php renamed from teaser.php.
Hope it helps,
Irsah