[[!+page.nav:notempty=`<nav>[[!+page.nav]]</nav>`]]
This question has been answered by john-siggran. See the first response.
Hi John,
did you try the getPage add-on already on retrieving and styling your pagination? A good start for this is the official documentation which includes some examples too:
http://rtfm.modx.com/display/ADDON/getPage
&pageNavOuterTpl=`[[+prev]]<a href="#header">Back to top</a>[[+next]]`
Hm, have you tried [[+prev:default=`your empty code`]] and [[+next:default=`your empty code`]]?
&pageNavOuterTpl=`[[+prev:default=`your empty code`]]<a href="#header" title="Back to the top"><span>Back to top</span></a>[[+next:default=`your empty code`]]`
Hey John,
you're right – very strange ... "default" overwrites every output like "empty" too. I tried some more variations, also with the "If" snippet but it just won't work as expected. After taking a look at the snippet code itself I think this needs a little change in order to return empty placeholders for prev/next:
https://github.com/opengeek/getPage/blob/master/core/components/getpage/include.getpage.php
But this may goes a bit too far. Instead you could give the siblingNav snippet a try?!
http://rtfm.modx.com/display/ADDON/SiblingNav
Or does anyone else has an idea?
if (!empty($pagePrevTpl) && ($page - 1) >= 1) {
$nav['prev'] = getpage_makeUrl($modx, $properties, $page - 1, $pagePrevTpl);
}
// and
if (!empty($pageNextTpl) && ($page + 1) <= $pageCount) {
$nav['next'] = getpage_makeUrl($modx, $properties, $page + 1, $pageNextTpl);
}
if (!empty($pagePrevTpl)) {
if (($page - 1) >= 1) {
$nav['prev'] = getpage_makeUrl($modx, $properties, $page - 1, $pagePrevTpl);
} else {
$nav['prev'] = x // where x = the default value for prev (the one set with :default)
}
}Please keep your behaviour at normal level!