<!-- Portfolio List-->
<div id="portfolio-list" class="content">
<?php
$results = $page->children->find("limit=8, sort=title");
$pagination = $results->renderPager();
foreach ($results as $i) {
$firstimg = $i->images->first();
$f700 = $firstimg->size(700,500);
echo "
<div class='four columns module-container {$i->parent->name}' style='padding-bottom:20px'>\n\t
<div class='module'>\n\t
<div class='module-img'>\n\t
<a href='{$i->url}' title='View item details'>\n\t
<img src='{$f700->url}' title='{$f700->description}' alt='{$f700->description}' />\n
</a>\n
</div>\n
<div class='module-meta'>\n\t
<h5>{$i->title}</h5>\n
<hr class='half-bottom' />\n
\${$i->Price}\n
{$i->body}\n
</div>\n
</div>\n
<span style='display:block;'><a href='{$i->url}'>{$i->title}, \${$i->Price}</a></span>
</div>\n\n\n
";
}
echo $pagination;
?>
</div>
<!-- /End Portfolio List-->
Pagination: Each page showing same content?
#1
Posted 30 October 2011 - 11:41 PM
I'm a freelance, processwire-using web designer based in california. work site | personal site | visuals
#3
Posted 31 October 2011 - 09:34 AM
I'm a freelance, processwire-using web designer based in california. work site | personal site | visuals
#4
Posted 31 October 2011 - 11:07 AM
$results = $page->children->find("limit=8, sort=title");
The $page->children call is actually causing all the children to be loaded, and then you are post filtering in memory. Since all the children are already loaded, it's not attempting to do any pagination. Replace it with this and it should start to work:
$results = $page->children("limit=8, sort=title");
#5
Posted 31 October 2011 - 02:38 PM
I'm a freelance, processwire-using web designer based in california. work site | personal site | visuals
#6
Posted 05 April 2012 - 08:20 AM
I want to use pagination on the homepage/ root page. I created a homepage template that displays articles from this structure:
/homepage/articles/article.
So I try to paginate all the single articles lying beneath "/homepage/articles/" (hope this is not confusing). It's
HOME
ARTICLES
Article 1
Article 2
Article 3
...
I was trying this code:
$results = $pages->find("template=article, limit=15, sort=title");
if(count($results)) {
$pagination = $results->renderPager(array(
'nextItemLabel' => "next",
'previousItemLabel' => "prev",
'listMarkup' => "<ul class='MarkupPagerNav'>{out}</ul>",
'itemMarkup' => "<li class='{class}'>{out}</li>",
'linkMarkup' => "<a href='{url}'><span>{out}</span></a>"
));
echo $pagination;
echo "<ul>";
foreach($results as $result) {
echo "<li><p><a href='{$result->url}'>{$result->title}</a><br /><span class='summary'>{$result->articleDescription}</span></p></li>";
}
echo "</ul>";
echo $pagination;
}
As result, I get the pagination navigation, but it's not working correctly. Clicking through the pages shows always the same results.
This query didn't work eather:
$results = $page->child("title=articles")->children("limit=5");
Any ideas? I was now trying for hours...
#10
Posted 08 April 2012 - 11:59 AM
#11
Posted 09 April 2012 - 03:36 PM
if(count($results)) {
...
}
(before I wrote if($results) which does not work.)
Good luck and have fun, I'm still in love with ProcessWire
I'm not sure, if I got your post right (my english is not very good at all...), but if you do not want to show all the page links (== numbers), you can try the option numPageLinks like
$pagination = $results->renderPager(array( 'numPageLinks' => 3 ));
I didn't try it, but perhaps 0 is also allowed as value, if you only want to show 'prev' and 'next' buttons.
Reference of all options is at the bottom of this page:
http://processwire.c...rkup-pager-nav/
#12
Posted 09 April 2012 - 04:51 PM
Yes I'm still loving PW too, and I think this will be a permanent thing, because of it's excellent API (instead of having to use lots of plugins like many other CMSs).
Thanks for the suggestion, yes, I saw that numPageLinks and I assumed '0' would turn it off, but it doesn't seem to
#13
Posted 10 April 2012 - 10:34 AM
$limit = 5;
$items = $page->children("limit=$limit");
$prev = $input->pageNum > 1? $input->pageNum-1 : 0;
$next = $items->getStart() + $limit < $items->getTotal() ? $input->pageNum+1 : 0;
if($prev) echo "<a href='{$page->url}page{$prev}'>Prev</a> ";
if($next) echo "<a href='{$page->url}page{$next}'>Next</a> ";
If you prefer to use the MarkupPagerNav module instead, then you could always just hide the numbered links with CSS:
ul.MarkupPagerNav li {
/* hide all the links */
display: none;
}
ul.MarkupPagerNav li.MarkupPagerNavNext,
ul.MarkupPagerNav li.MarkupPagerNavPrevious {
/* display just the next/prev items */
display: inline;
}
#14
Posted 10 April 2012 - 10:44 AM
I've been so enthused by the power and flexibility of PW I've bought a book that was recommend here on the forum in the hope I end up needing less and less of these brilliant examples as time goes by
#15
Posted 10 April 2012 - 12:38 PM
#16
Posted 10 April 2012 - 01:43 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













