php - Display 'prev' and 'next' pagination, even when inactive, in Modx Revolution's Articles? -


i have blog set in modx revolution using articles addon, i'm having trouble configuring parts of pagination. current call pagination looks this:

[[!+page.nav:notempty=`<nav>[[!+page.nav]]</nav>`]] 

i've added following listing parameters getpage call, removes [[+first]] , [[+last]] template pagination, , insert static "back top" link:

&pagenavoutertpl=`[[+prev]]<a href="#header">back top</a>[[+next]]` 

however, 1 thing still doesn't work intend. default previous , next links disappear if there no previous or next page. i'd rather display them , make them inactive in such case. way pagination looks same, inactive parts can grayed out.

it seems include.getpage.php contains following lines (which prevent prev , next links shown when there no pages navigate to):

// lines 16 - 18  if (!empty($pageprevtpl) && ($page - 1) >= 1) {     $nav['prev'] = getpage_makeurl($modx, $properties, $page - 1, $pageprevtpl); }  // , lines 29 - 31  if (!empty($pagenexttpl) && ($page + 1) <= $pagecount) {     $nav['next'] = getpage_makeurl($modx, $properties, $page + 1, $pagenexttpl); } 

which makes sense, prohibits me displaying placeholders want to. i'm trying achieve this:

// example lines 16 - 18  if (!empty($pageprevtpl)) {     if (($page - 1) >= 1) {         $nav['prev'] = getpage_makeurl($modx, $properties, $page - 1, $pageprevtpl);     } else {         $nav['prev'] = x // x = default value prev (set :default)     } } 

a simple else or elseif above trick, gone after upgrade. have ideas on best way approach this? there way achieve want without changes getting overwritten on upgrade? property set or something? i'm hoping knows how this.

for clarity: answer posted op. did because none of other answers par (the posters never responded comments/suggestions), , don't want give 150pt. bounty answer isn't good. since automatically awards bounty given answers (without offering choice of not awarding op), i've decided way. i'd rather not award bounty, give doesn't put in effort it.

so, since bug in articles include.getpage.php snippet, decided solve php well. used snippet called nav.placeholder insert placeholder when necessary. it's called articles template so:

<!-- secondary navigation --> <!-- insert nav tag when there pagination --> [[!+page.nav:notempty=`<nav>`]]    <!-- call nav.placeholder snippet , test if placeholder needed -->   [[!nav.placeholder? &nav=`[[!+page.nav]]` &before=`1`]]   <!-- display regular pagination, without surrounding tags -->   [[!+page.nav:notempty=`[[!+page.nav]]`]]   <!-- call nav.placeholder snippet , test if placeholder needed -->         [[!nav.placeholder? &nav=`[[!+page.nav]]` &before=`0`]] <!-- insert /nav tag when there pagination --> [[!+page.nav:notempty=`</nav>`]] 

this call passes content of page.nav (with nav variable) snippet , tells in position of menu before variable (so won't insert placeholder @ wrong place).

the snippet looks this:

if (strstr($nav, "older") != false && $before == 1) {   return "insert 'newer' placeholder content here"; } elseif (strstr($nav, "newer") != false && $before == 0) {   return "insert 'older' placeholder here"; } 

i know pretty hacky, , not dynamic, works, won't overwritten on upgrade , done in cms without ugly js or css hacking.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -