Search the Community
Showing results for tags 'previous'.
-
Hi all, I have the following simple code for next/previous links on article pages: <!-- Next article --> <?if($page->next->id) { ?><i class="icon-chevron-left"></i> <a href="<?echo $page->next->url; ?>"> <?=${'previous_'.$countryCode}; ?></a><? } ?> <!-- /Next article --> <!-- Previous article --> <?if($page->prev->id) { ?> <a href="<?echo $page->prev->url; ?>"><?=${'next_'.$countryCode}; ?></a> <i class="icon-chevron-right"></i> <? } ?> <!-- /Previous article --> It all works correctly but there's a certain type of article I need to exclude from the next/previous links (any page that has options field 'content_type' with a value of '6'). I'm trying to figure out a way to get 'next' and 'previous' but if 'content_type' on that page has a value of '6' then skip it. Can anyone help with some clues on how this might be done? I've had a look at using the pagination code as well as looking at grabbing 'siblings' and filtering them but come to a dead end. Thanks!
-
Hi, I'm setting up some next/prev page linking code. I only want those links to show if the page's publish_date field is less than today. Here's my convoluted and cobbled-together code: <?php $today = time(); if($page->prev->getUnformatted('publish_date')<$today) echo "<li id='prev'><a rel='nofollow' title='{$page->prev->title}' href='{$page->prev->url}'>{$page->prev->title}</a></li>"; if($page->next->getUnformatted('publish_date')<$today) echo "<li id='next'><a rel='nofollow' title='{$page->next->title}' href='{$page->next->url}'>{$page->next->title}</a></li>"; Firstly, is there a way to simplify this? Secondly, if there's no value returned for the previous page (for example) it still outputs the HMTL. ie: <li id='prev'><a rel='nofollow' title='' href=''></a></li> Thanks for any help. Cheers Marty