Next & Previous Nav Block Question

Permalink 1 user found helpful
Is it possible to have the parent page included in the next/previous text?

For example, I can add the text as "Previous Post" or "Next Post" no problem. What I'd like to do is have the parent page reflected in the title somehow.

For example: "Previous Music Post" / "Next Music Post" or "Previous Gaming Post" / "Next Gaming Post" and so on.

Can anyone help steer me in the right direction of achieving this?

Cheers in advance!

 
goodnightfirefly replied on at Permalink Reply
goodnightfirefly
This can be achieved through Custom Templates [http://www.concrete5.org/documentation/using-concrete5/in-page-edit... ]

I've created one for you to get you started, extract the attached file to yoursite/blocks/next_previous/templates/parent_name.php

Then while in edit mode, click on your Next & Previous block, and choose Custom Template. 'Parent Name' will now be an option.

Compare this file to the original output file located at yoursite/concrete/blocks/next_previous/view.php to see what I changed to achieve this.
goodnightfirefly replied on at Permalink Best Answer Reply
goodnightfirefly
Attachments aren't working for me at the moment, here is the code for parent_name.php

<?php defined('C5_EXECUTE') or die("Access Denied.");
$nh = Loader::helper('navigation');
$previousLinkURL = is_object($previousCollection) ? $nh->getLinkToCollection($previousCollection) : '';
$parentLinkURL = is_object($parentCollection) ? $nh->getLinkToCollection($parentCollection) : '';
$nextLinkURL = is_object($nextCollection) ? $nh->getLinkToCollection($nextCollection) : '';
$this_page = Page::getCurrentPage();
$parent_page = Page::getByID($this_page->getCollectionParentID()); 
?>
<div id="ccm-next-previous-<?php echo $bID; ?>" class="ccm-next-previous-wrapper">
    <?php if ($previousLinkText): ?>
   <div class="ccm-next-previous-previouslink">
      <?php echo $previousLinkURL ? '<a href="' . $previousLinkURL . '">' . $previousLinkText . ' ' . $parent_page->getCollectionName() . ' post' . '</a>' : ' ' ?>
    </div>
   <?php endif; ?>
   <?php if ($parentLinkText): ?>
Nanco replied on at Permalink Reply
This is just what I was after!

Truth be told, I have tried a few things prior to my original post, none of which worked (PHP isn't my first language admittedly).

Many thanks for your help!