Page Public Date - Two Questions

Permalink 1 user found helpful
I realized that the Page Public Date is a little misleading in that it doesn't actually publish the page to the public on the date inputted (which would be a great feature, by the way!) I know this can be done through Advanced Permissions, but's such a simple feature that should work without Advanced Permissions. questions:

1.) Is there an easy way to edit the Page List view.php file to grab the Page Public Date and then NOT show the page in the page list if the public date is in the future?

2.) I have an attribute on my News Page for "Breaking New" (just a true/false checkbox). I want it so that if this box a checked, a breaking news banner shows accross the homepage with a link to the Breaking News Article. How can I make this only show up for one or two days after the Page Public Date?


View Replies: View Best Answer
12345j replied on at Permalink Best Answer Reply
1) definitely. First,, id grab jordans page list template. It is much easier to modify.
then, just add this.
lin 145:

line 152

2) i'd probably modify this a bit. first, id install this addon
and make the breaking news attribute a page selector attribute. Id do this because then the banner could be linked to the breaking news page.
then, id use this code wherever you want the breaking news banner to be
$news = Page::getByPath('/news');
        //do your banner thing here
        //one handy tip would be that if you want to display the title of the article, use $bnews->getCollectionName();
        //so something like this
        //<?php Loader::helper('navigation');
        // $link=NavigationHelper::getLinkToCollection($bnews, true); ?>
        // <a href="<?php echo $link;?>"><div class="banner breaking-news">
        // <?php echo t('Breaking News: ').$bnews->getCollectionName(); ?>
        // </div> </a>
leinteractive replied on at Permalink Reply
Thanks. That makes sense.

I don't think I need the Page Selector attribute though. The "banner" wouldn't be an image as the term banner would suggest.

Juts a red box on the page that says "Breaking News!" and then pulls in the title of the page with the Breaking News attributed turned on.

Thanks...very helpful!
12345j replied on at Permalink Reply
You'd still want the page selector, without it you won't get the page title.

Sent from my iPod
leinteractive replied on at Permalink Reply

Why can't I just make a Page List to load 1 page, and then edit the template to check for the breaking_news attribute, grab it, publish the page title and use the code you provided to only display within 24 hours of the public date?
12345j replied on at Permalink Reply
you cold definitely do that. I misunderstood your question though, I thought you wanted part 2 it as a standalone block.