Using pdoPage pagination placeholders
Hello,
Is it possible to show «Showing 1 to 5 of 15 (3 Pages)», «Showing 6 to 10 of 15 (3 Pages)», «Showing 11 to 15 of 15 (3 Pages)»,...etc with pdoPage? is there a placeholder for firstItem and lastitem? I have been searching online but I cannot find any solution to my question.
Is it possible to show «Showing 1 to 5 of 15 (3 Pages)», «Showing 6 to 10 of 15 (3 Pages)», «Showing 11 to 15 of 15 (3 Pages)»,...etc with pdoPage? is there a placeholder for firstItem and lastitem? I have been searching online but I cannot find any solution to my question.
Комментарии: 4
You could just wrap your call with another snippet:
pdoPageWrapper:
[[!pdoPageWrapper?
&parents=`0`
&limit=`5`
]]
[[!+page.nav]]
pdoPageWrapper:
<?php
$output = $modx->runSnippet('pdoPage', $scriptProperties);
$total = $modx->getPlaceholder('page.total');
$pages = $modx->getPlaceholder('pageCount');
$page = $modx->getPlaceholder('page');
$from = (($page - 1) * $limit) + 1;
$to = (($page - 1) * $limit) + $limit;
if ($to > $total) {
$to = $total;
}
return $output . "<p>Showing $from to $to of $total ($pages pages)</p>";
Thank you, this works.
I'm using the pdoPageWrapper with the mFilter2 snippet. I have created to placeholders with the snippet that you wrote.
I'm using the pdoPageWrapper with the mFilter2 snippet. I have created to placeholders with the snippet that you wrote.
<?php
$snippet = $modx->getOption('snippet', $scriptProperties, 'pdoPage');
$output = $modx->runSnippet($snippet, $scriptProperties);
$total = $modx->getPlaceholder('page.total');
$pages = $modx->getPlaceholder('pageCount');
$page = $modx->getPlaceholder('page');
$from = (($page - 1) * $limit) + 1;
$to = (($page - 1) * $limit) + $limit;
if ($to > $total) {
$to = $total;
}
$modx->setPlaceholder('page.from',$from);
$modx->setPlaceholder('page.to',$to);
return $output;
But now the placeholders doesn't work with the ajax mode. How can I get this to work with mFilter2 Ajax mode?
mFilter2 have special option &paginator.
So
So
[[!mFilter2?
&paginator=`pdoPageWrapper`
&...
]]
How can I get this to work with mFilter2 Ajax mode?Please, send all questions about paid extras to the modstore.pro support.
I'm sorry but I'm not getting the Ajax pagination to work. Can you explain to me where I'm going wrong?
[[!mFilter2?
&parents=`[[*id]]`
&paginator=`pdoPageWrapper@pagepagination`
&element=`msProducts`
&class=`msProduct`
&sortold=`ms|price:desc`
&sort=`resource|menuindex:asc`
&limit=`3`
&tplOuter=`nd.tpl.mFilter2.outer`
&tpl=`nd.tpl.msProducts.row`
&tplFirst=`nd.Firsttpl.msProducts.row`
&tpl_n3=`nd.Thirdtpl.msProducts.row`
&tplLast=`nd.Lasttpl.msProducts.row`
&includeThumbs=`246x246`
]]
Snippet<?php
$snippet = $modx->getOption('snippet', $scriptProperties, 'pdoPage');
$output = $modx->runSnippet($snippet, $scriptProperties);
$total = $modx->getPlaceholder('page.total');
$pages = $modx->getPlaceholder('pageCount');
$page = $modx->getPlaceholder('page');
$from = (($page - 1) * $limit) + 1;
$to = (($page - 1) * $limit) + $limit;
if ($to > $total) {
$to = $total;
}
$modx->setPlaceholder('page.from',$from);
$modx->setPlaceholder('page.to',$to);
return $output;
Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.