Custom Prev/next Block

Permalink
Hi,

I'm currently working on a site for an artist.

With the prev/next block you can move through the artwork pages.
You can see my example here:http://grafomantestsite.be/index.php/works/Deep-Blue...

I customized the view.php file for the block like this:
<?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) : '';
$previousLinkText = is_object($previousCollection) ? $previousCollection->getCollectionName() : '';
$nextLinkText = is_object($nextCollection) ? $nextCollection->getCollectionName() : '';
?>
<?php if ($previousLinkURL || $nextLinkURL || $parentLinkText): ?>
    <div class="ccm-block-next-previous-wrapper"> 
        <?php if ($previousLinkText): ?>
            <span class="ccm-block-next-previous-previous-link">
                <?php echo $previousLinkURL ? '<a href="' . $previousLinkURL . '">' . '< Previous' . '</a>' : '' ?>
            </span>
        <?php endif; ?>


Now for my question: is it possible to hide the previous link when there is no previous page? So you just have 'ALL WORKS NEXT > '

And to hide the next link when there is no next page? So you just have ' < PREVIOUS ALL WORKS '


Thanks!

 
grafoman replied on at Permalink Reply 1 Attachment
Update: In the block options i deselected 'Loop Navigation'. Now the both the previous and next buttons are gone. So you can only click on 'All Works'...

I added a screenshot of the sitemap

When i check 'loop navigation' the next and previous button become visible, but the links to the next and previous pages are not correct. However, the loop function links work..

So the problem is with the link to the next page, when there is no loop. And the link to the previous page, again, when there is no loop.
grafoman replied on at Permalink Best Answer Reply
I re-enabled loop navigation.

The main problem: on some artworks the attribute 'exclude from nav' was selected.. So make sure this is not selected and the next and previous button should work fine.