I have solved the problem for me. Here is a very comprehensive explanation.
Purpose:
To get rid of the relational links (next/prev page links) depending on where they lead to. For example, if you have in your template:
{cms_selflink dir="next"}
this method would allow you to hide the next link depending on what the next page actually is.
Background Information:
The {cms_selflink dir="next"} will lead the the
very next page. For example:
1 Home
2 About
2.1 Who We Are
2.1.1 Our History
2.1.2 Future plans
3 Mission
In the navigation structure above, if {cms_selflink dir="next"} were placed on the about page, it would link to who we are. If {cms_selflink dir="next"} were placed on the "our history" page, it would link to "future plans". If it were placed on the future plans page, it would link to Mission.
Steps: (for excluding a page from the NextLink)
1. First, you need to visit the page directly before the one you want to exclude. So in the example above, If I wanted to exclude mission from the NextLink, I would visit the future Plans page.
2. Go into View >> Page Source. Find where the next link is displayed. Copy the html. What you should copy should be something like this:
Next page: Mission
Be sure to include the label ("Next page:" in the example above), as well as the link. In other words, include any html created by the {cms_selflink dir="next"} tag.
3. Go into the template, and find where the {cms_selflink dir="next"} tag is. Replace it with {cms_selflink dir="next" assign="nextlink"} .
4. Create an if statement as follows (using the example from step 2) using the html you copied
{if $nextlink != 'Next page: Mission'}{$nextlink}{/if}
Explination of Code
Using this example, I will explain the code:
Code: Select all
{cms_selflink dir="next" assign="nextlink"}
{if $nextlink != 'Next page: <a href="http://example.com/mission" title="Mission">Mission</a>'}{$nextlink}{/if}
The {cms_selflink dir="next" assign="nextlink"} assigns the contents of {cms_seflink dir="next"} to a variable. This makes it possible to minipulate it with an if statement.
The {if $nextlink != 'Next page: Mission'} checks that the selflink is not linking to a page called Mission. If the contents of {cms_seflink dir="next"} is equal to that of Next page: Mission , then there is a match. The operator != prevents the nextlink from being displayed if the pages match.
The call to {$nextlink} is simply a shorter way of writing out {cms_selflink dir="next"} , becasue {cms_seflink dir="next"} is already contained in the variable $nextlink.
And of course, the if statement must be closed off with {/if}.
Notes
1. You may need to include multiple conditions for the if statement because visitors could visit
http://example.com or
http://www.example.com . This would look something like this:
{if $nextlink != 'Next page: Mission' || $nextlink != 'Next page: Mission'} .
This is as of yet untested, but I see no reason why it should not work.
2. The condition 'Next page: Mission' MUST BE VERBATIM for the html that {cms_selflink dir="next"} creates. You should also enclose it in single instead of double quotes because there will be double quotes in the html.
{if $nextlink !=
'Next page: Mission
'}
3. This same process can be done to exclude pages from {cms_selflink dir="prev"} also. Keep in mind if you want to exclude a pages from the relational links completely, you need to do this process once for the NextLink, and once for the PrevLink.
Regards.
Isaac.