cms_selflink dir="next" only if there is a next SIBLING page?
Posted: Thu Sep 11, 2008 11:08 pm
I'd like to use the {cms_selflink dir="next"} tag to create automatic links to the next page, but I find it very confusing to users that it will link to the next page in your site even if that page is on a completely different level.
I need a next page link that will only show up if there is a next SIBLING page to link to. If the current page is the last page within it's parent, then there should be no next link as there is no logical page to link to.
I've looked through all of the tags parameters and there doesn't seem to be a way to do it. I've searched extensively on this forum and many people have asked the same thing but I cannot find a definitive answer for how to do it. I'd prefer to add some PHP logic straight to my template (or put it in a custom tag) that says something like:
if (this page has a next sibling) {
cms_selflink dir="next"
} else (if this is the last page in this group) {
show nothing
}
I don't know PHP otherwise I imagine this would be simple to write. Can anyone help me out to get this functionality or share other solutions you have found?
I need a next page link that will only show up if there is a next SIBLING page to link to. If the current page is the last page within it's parent, then there should be no next link as there is no logical page to link to.
I've looked through all of the tags parameters and there doesn't seem to be a way to do it. I've searched extensively on this forum and many people have asked the same thing but I cannot find a definitive answer for how to do it. I'd prefer to add some PHP logic straight to my template (or put it in a custom tag) that says something like:
if (this page has a next sibling) {
cms_selflink dir="next"
} else (if this is the last page in this group) {
show nothing
}
I don't know PHP otherwise I imagine this would be simple to write. Can anyone help me out to get this functionality or share other solutions you have found?