Modify Previous Next functionality to list the parent's next and previous pages
Permalink
Hello,
Like the title says I would like to modify the previous next blocks functionality to list the parents next and previous pages.
I'm creating a website for a local business at the moment and they have a past projects section of their website.
So for example:
Past Projects -> Past Projects 2014 -> (Project)
At the moment I managed to add my own template for the previous next block which looks like this:
This works really well and I'm quite pleased with it however I need to add a similar template to the right of the website so I created another template:
I would like this template to get the parent page's next and previous (2014, 2013) so I can put it as previous and next years.
Next Year
2014
Previous Year
I would also like it to link to the actual page for previous and next year (Past Projects 2013)
Any help is much appreciated.
Like the title says I would like to modify the previous next blocks functionality to list the parents next and previous pages.
I'm creating a website for a local business at the moment and they have a past projects section of their website.
So for example:
Past Projects -> Past Projects 2014 -> (Project)
At the moment I managed to add my own template for the previous next block which looks like this:
<?php defined('C5_EXECUTE') or die("Access Denied."); $nh = Loader::helper('navigation'); $previousLinkURL = is_object($previousCollection) ? $nh->getLinkToCollection($previousCollection) : ''; $nextLinkURL = is_object($nextCollection) ? $nh->getLinkToCollection($nextCollection) : ''; ?> <ul class="nav"> <?php if ($nextLinkURL) { echo "<li class>"; echo $nextLinkURL ? '<a href="' . $nextLinkURL . '">Next Project</a>' : ''; echo "</li>"; }else{ echo "<li class='inactive'><a>Next Project</a></li>"; }
Viewing 15 lines of 24 lines. View entire code block.
This works really well and I'm quite pleased with it however I need to add a similar template to the right of the website so I created another template:
<?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) : ''; ?> <ul class="nav"> <?php if ($parentLinkURL) { echo "<li class>"; echo $parentLinkURL ? '<a href="' . $parentLinkURL . '">' . $parentLinkText . '</a>' : ''; echo "</li>"; } ?>
Viewing 15 lines of 16 lines. View entire code block.
I would like this template to get the parent page's next and previous (2014, 2013) so I can put it as previous and next years.
Next Year
2014
Previous Year
I would also like it to link to the actual page for previous and next year (Past Projects 2013)
Any help is much appreciated.