Jump to content

Search the Community

Showing results for tags 'pagination'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. I have $results = $pages->find('template=boat_vessel, sort=-boat_date_list, start=0, limit=3, '.$selector); $content .= $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>", 'numPageLinks' => 999, )); But I go to /page2 and the same 1st page of results is displayed, and the pagination itself doesn't change, there's no previous link, the page 1 link is still classified as current.
  2. Hi. I've got a client that wishes to see all the page links in the rendered pagination, without the separator (...). Is this possible? I know the page links may get reeeeally long, but that's what he wants. I know there are optional arguments that can be passed to renderPager(), but I can't see one for removing the separator. Any suggestions folks?
  3. Hi, I am using pagination with ajax. When i click on any page number url not changing because of ajax call So when i click on page 3 and then click on page 7 i hit the back button it returns to page 1 because url never changing Here is my site: www.sediremlak.com For real estate sites if visitor find a property on page 4 and click on that property page. After click on back button site jumps to first page or home page not page 4 How can i fix this problem?
  4. Hi, I just wanted to check whether or not the following topic is still valid with respect to PW 3.x: https://processwire.com/talk/topic/22-how-to-build-a-news-page/ I am trying to integrate a news section into a basic multisite PW website installation (voluntary project) intended for a community of two villages. Currently there are 4 subdomains (hca-site, hfi-site, hhg-site, hps-site) that link back to the main domain website (https://thehanneys.uk) by clicking on their home buttons. I had a look at the Blog (ProcessBlog & MarkupBlog) module but it is not really what I'm looking for - a simple News section. At the moment we're just concentrating on getting the functionality in place. The styling can come later. The first issue encountered is that there is no checkbox under the Advanced section for "Page Numbers" to turn them on for the news-index template. Secondly, I don't understand why the following text is being displayed above the navigation when I expected it to be displayed after the page title. Thirdly, are the story pages displayed on the index page simply by creating a new child under News (page based on news-index.php template)? Showing 0 of 0 Article(s) | Page 1 of 0 The current code for the news-index.php template is as follows: <?php namespace ProcessWire; // basic-page.php template file // See README.txt for more information // Primary content is the page's body copy $content = $page->body; // If the page has children, then render navigation to them under the body. // See the _func.php for the renderNav example function. if($page->hasChildren) { $content .= renderNav($page->children); } // if the rootParent (section) page has more than 1 child, then render // section navigation in the sidebar if($page->rootParent->hasChildren > 1) { $sidebar = renderNavTree($page->rootParent, 3) . $page->sidebar; } // start the news stories list echo "<ul>"; // get the stories for this page $stories = $page->children("limit=6, sort=-date"); // note if you set the stories to sort by date descending on the /news/ page // in the admin, then you can omit the "sort=-date" above. // cycle through each story and print it in a <li> foreach($stories as $story) { echo " <li><a href='{$story->url}'>{$story->title}</a> <p><strong>Date:</strong> {$story->date}</p> {$story->body} </li> "; } echo "</ul>"; // get values for our placemarker headline $start = $stories->getStart(); $end = $start + count($stories); $total = $stories->getTotal(); $num = $input->pageNum; $lastNum = ceil($total / $stories->getLimit()); // output the placemarker headline echo "<h5>Showing $start - $end of $total Article(s) | Page $num of $lastNum</h5>"; // output pagination links echo $stories->renderPager(); The current code for the news-story.php template is as follows: <?php namespace ProcessWire; // basic-page.php template file // See README.txt for more information // Primary content is the page's body copy echo "<div id='bodycopy'>"; $content = $page->body; echo "</div>"; // If the page has children, then render navigation to them under the body. // See the _func.php for the renderNav example function. if($page->hasChildren) { $content .= renderNav($page->children); } // if the rootParent (section) page has more than 1 child, then render // section navigation in the sidebar if($page->rootParent->hasChildren > 1) { $sidebar = renderNavTree($page->rootParent, 3) . $page->sidebar; } P.S. Are there any books/tutorials specifically covering PW 3.x? Any assistance would be greatly appreciated.
  5. Hello. I am working on a culinary web project where I am aiming at listing all recipes with a pagination after reaching the recipe limit. As far as I already did the pagination on another project, I was quite happy to use the code and see it in action. However, my joy was not lasting long as far as the present pagination HTML code differs from the other and I was scratching my head today for several hours and yet no solution to precisely match the styling. I was able to apply the pagination, show the prev/next and numbers properly, however the active class is not applied properly and the design has the prev/next arrows at the both ends of the recipe block (image attached). Here is the pagination original html code: <!-- Pagination --> <div class="sixteen columns"> <div class="pagination-container"> <nav class="pagination"> <ul> <li><a href="#" class="current-page">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> </ul> </nav> <nav class="pagination-next-prev"> <ul> <li><a href="#" class="prev"></a></li> <li><a href="#" class="next"></a></li> </ul> </nav> </div> </div> And here is my pagination code (after making sure that the template pagination is enabled): <div class="sixteen columns"> <div class="pagination-container"> <?php echo $result->renderPager(array( "nextItemLabel" => __(">>"), "previousItemLabel" => __("<<"), "currentItemClass" => "current-page", 'listMarkup' => "<nav class='pagination'><ul>{out}</ul></nav>", 'itemMarkup' => "<li>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>" )); ?> <nav class="pagination-next-prev"> <ul> <li><a href="#" class="prev"></a></li> <li><a href="#" class="next"></a></li> </ul> </nav> </div> </div> As far as the pagination active class is not applied on the <li> but on the <a href... > I tried to change the linkMarkup to: 'linkMarkup' => "<a href='{url}' class='{class}'>{out}</a>" however that shows that the {class} is not applied with linkMarkup but with itemMarkup. Tried to add the class to itemMarkup too, but the same result is showing. For sure the navigation is not an issue if it is next to the numbers, however I wanted to attempt to match fully the style and learn how can I move the prev and next pointers away from there or in other words to match the original theme. So any ideas how to achieve the proper functionality and obtain the previous/next page links? I read so many tutorials and manuals today mentioning to use prev() and next() but in my case the results are not coming from $page and the next page pointed to the next page in my admin but not the next results page.
  6. Hello PW community, I've a search form which return selected items with pagination. Everything works fine, also the pagination display correctly all results through pages. The issue is given only for selected results pagination as the latter does not start from page 1 but it revert back results from the current page (e.g. if you are in page 3, and submit a result from selects form, than all related items are displayed - not starting from page 1 but from page 3, which means something a fake "no results"). This is the classic function of render pager: echo $works->renderPager(array('arrayToCSV' => false)); Any idea? Thanks! Edit: I've also tried the "start=0" within the selectors, however it Always re-start from page 1 and stick to that, regardless. So no more option to move to page 2, 3, ....
  7. I was wondering how to achieve the following. A total of 100 pages which are listed with a limit of 10 items per page, resulting in 10 pages of 10 items. Instead i desire the following (below), and wondering how to setup the code / selector(s). The first page should show a list of 8 items. After that all following pages should have a limit of 10 items. page 1 -> items 1 - 8 -> (limit 8) page 2 -> items 9 - 18 -> (limit 10) page 3 -> items 19 - 28 -> (limit 10) ... page 9 -> items 79 - 88 -> (limit 10) page 10 -> items 89 - 98 -> (limit 10) page 11 -> items 98 - 100 -> (limit 10) The ideal situation would be to have an extra page selector property aside of 'limit', something named 'limit_first' or alike.
  8. Hello All, I have setup a blog and added pagination to it with Pager (Pagination) Navigation I have followed the Docs. However when I click on the next page the page just reloads but the blog posts do not change. news/?page=2 etc is added to the URL but the results stay the same any ideas? The code Iam using is below. Cheers Jon <?php $results = $pages->find("template=news-item|news-item-right-gallery, limit=2, sort=-news_date"); $pagination = $results->renderPager(); foreach($results as $result) {?> <div class="news-article"> <div class="row"> <div class="medium-3 columns"> <?php if($result->single_image) $large = $result->single_image->width(150); $small = $result->single_image->width(590); echo "<img data-interchange='[{$small->url}, small], {$small->url}, medium], {$large->url}, large]'>";?> </div> <div class="medium-9 columns"> <?php echo "<h2><a class='title' href='{$result->url}'>{$result->title}</a></h2>"; echo "<p class='published'><i class='fa fa-calendar' aria-hidden='true'></i> On - {$result->news_date}</p>"; if ($result->excerpt) { echo $result->excerpt; }else{ echo $result->body; } ?> <a href="<?php echo $result->url ?>" class="button small">Read More</a> </div> </div> </div> <?php } echo $pagination; ?>
  9. Good day! Suddenly I stumbled upon pagination once again. Pagination itself works as expected, but renderPager() returns the same markup on every paginated page. So it is 1st page current on every /pageN/. What can cause this? Please help.
  10. Hello, I'm new to PW and need some help. I created a simple gallery which is working fine, but I can't figure it out how to create some styling for pagination. I use this for pagination: <?= $a->renderPager() ?> My html look like this: <div class="numeric-pagination"> <a href="#" class="button"><i class="icons icon-left-dir"></i></a> <a href="#" class="button">1</a> <a href="#" class="button active-button">2</a> <a href="#" class="button">3</a> <a href="#" class="button"><i class="icons icon-right-dir"></i></a> </div> I hope you understand what I want to create. Thank you R
  11. Hi Guys This is possibly a stupid question but I can't get it to work. How can I limit the max number of pages I get and paginate them afterwards with a different limit(per pagination page)? Lets say I have a total of 1000 Events. I want to output 100 Events (10 Events per pagination page). // outputs 10 events per page but returns all 1000 events - how pagination works default $items = $pages->find("template=event, limit=10"); // should output 10 events per page but should only use the 100 latest events for output - doesn't work // Try 1 $items = $pages->find("template=event, limit=100")->find("limit=10"); // Try 2 $items = $pages->find("template=event, limit=10, getTotal=100"); // output pager echo $items->renderPager(); Can someone clarify that to me? Greetings Orkun
  12. Hello I am using a dynamically created Pagination like: $allImages = $page->VitrineImages; $limit = $page->VitrineImageCount; $start = ($input->pageNum - 1) * $limit; $images = $page->VitrineImages->slice($start, $limit); $total = count($page->VitrineImages); $a = new PageArray(); foreach($images as $unused) $a->add(new Page()); $a->setTotal($total); $a->setLimit($limit); $a->setStart($start); this works fine in the template file to create Pagination in relation to the number of images for that field in the page. But I have problems to include that inside a sitemap template (I am using the code from here -> https://processwire.com/talk/topic/3846-how-do-i-create-a-sitemapxml/?page=1 ) It doesn't create anything when I use the same code in the sitemap.php only replacing the $page variable with $homepage which is defined in _init.php (which is prepended for the sitemap template - and it's inside the $homepage page where I use the pagination in that way) It seems I am missing something (kind of new to processwire) because $a is always 0 when using this code in my sitemap.php file...
  13. TL;DR How to change a paginated URL so it reads "example.com/foo/2/" instead of "example.com/foo/page2/"? Excuse me if this is the wrong place to post this (in which case please move this to the right forum), or this has been asked before... but how do you remove the "page" prefix in a paginated url so that it reads something like "example.com/foo/1/" instead of the default of "example.com/foo/page1/"? I know that for any other type of prefix, I can just override $config->pageNumUrlPrefix in site/config.php, but I can't figure out how you'd do it if you simply want an effectively "blank" prefix. I've tried setting $config->pageNumUrlPrefix = '' but that ends up breaking pagination altogether or the page prefix ends up in the URL instead. The only way I can think of doing this is actually changing the line: if(!$pageNumUrlPrefix) $pageNumUrlPrefix = 'page'; to if(!$pageNumUrlPrefix) $pageNumUrlPrefix = ''; but tampering a module file seems bad practice and so I am looking for a better way to achieve this. Help a ProcessWire noob out!
  14. Hi all, I've just noticed a strange issue with some paginated pages on my site UKMoths, (http://ukmoths.org.uk). I have a series of pages showing thumbnails of moths by family, here: http://ukmoths.org.uk/thumbnails. The opening page shows the families but as you drill down, it displays all the species within a certain family. If there are more than 12 then the output is paginated using standard MarkupPagerNav functionality. On some however, I've noticed some long strings of random characters between the base url and the page notifier. For example the crambidae list has 140 species so has about 12 pages. Page 1 is fine, showing /thumbnails/crambidae, but pages beyond this, instead of the urls being like /thumbnails/crambidae/page2 they are something like /thumbnails/crambidae/BVXAz1div6cNWKM3P5NDP7EoP4WA .... (cut for brevity) ... CSCHd6.9c6Nhh/page2. I can't for the life figure out why this is happening. It seems to be the case for both ProCache version pages and non-cached (when logged in). If I look at the ProCache folder in the assets, the structure looks to be correct - i.e. a crambidae folder and then page2, page3 etc. folders. I should point out that the pages render correctly, even with these odd urls. It doesn't happen across the board though - it just seems to be certain ones - the /thumbnails/elachistidae folder pagination is fine - yet they're all using the same template. And the same site on my dev system is fine. Confused! Any one have any thoughts? Thanks, Ian.
  15. I'm just looking at trying to modify the output of the renderPager function. Instead of <li> for the page numbers, we need a select menu. Is it possible to modify the HTML that is returned or will I need to write my own function? Historically I would have used some form of override (Joomla) or inheritance to achieve this. What is the best way to 'build' on the PW core rather than rewrite it? What we're looking to achieve is have a dropdown rather than the intermediary numbers e.g. 1 ~ DROPDOWN ~ LASTPAGE
  16. Hi, I have some pagination on my page, which is pretty bog standard. $allChildren = $page->find('template=blog-article, limit=10, sort=-article_date'); The limit is set to 10 as I want to show them 10 articles at a time. The articles are displayed side by side, so there is 5 rows of 2 article. I am using infinite scroll plugin (which doesn't really matter). However the first article is a featured article and displays full width, so this leaves me with an odd article at the end. - - - (1) - - - - (2) - (3) - - (4) - (5) - - (6) - (7) - - (8) - (9) - - (10) So really I need the first page to show 11 and then on other pages for it to be 10. - - Page 1 - - - - - (1) - - - - (2) - (3) - - (4) - (5) - - (6) - (7) - - (8) - (9) - - (10) (11) - - - Page 2 - - - (12) (13) - - (14) (15) - - (16) (17) - - (18) (19) - - (20) (21) - - - Page 3 - - - (22) (23) - - (24) (25) - - (26) (27) - - (28) (29) - - (30) (31) - Is this possible? Any pointers would be much appreciated! Thanks, Craig
  17. Hi, Run into a bit of an issue with pagination on a site I am working on. I am sure the answer is really simple, but struggling to figure out what's going wrong. I have a bunch of articles, but I only want the ones where the date is less than the current date. I then want to limit the array so that I can paginate it. <?php $allNews = $page->children("template=news"); $oldNews = new PageArray(); foreach($allNews as $article) : if(strtotime($article->date) <= strtotime('now')): $oldNews->import($article); endif; endforeach; $oldNews = $oldNews->find('limit=2, sort=date'); echo $oldNews->renderPager(); foreach ($oldNews as $article) : ... endforeach; ?> The limit is being applied, however I don't see any pagination and navigation to the different pages returns the same first two articles. Any help would be much appreciated. Thanks, Craig
  18. One of my blogs seems to be accessible from multiple URLs and it's affecting my clients SEO. For example, using the following URL structures, I can access the same page. http://www.domain.not/blog/page2/ http://www.domain.not/blog/posts/page2/ The correct one is probably the second one as all posts are children of blog. My actual blog structure is as follows Blog - Posts -- Post A -- Post B -- Post C (etc) - Tags - Categories I have pagination enabled on a template called blog-posts which is applied to the Posts page. I'm not sure though why the double URL is occouring?
  19. Hi folks, I am using pagination on a news overview on my site. I have three queries set up on this page; a display first post, a display the next six (excluding the first) and then everything else (so excluding the first and the next six); so in theory the part I want to paginate starts at post 7 onwards. The only issue I have is when I click to the next page (page2) it shows the first post, the next six, then everything else, again. I understand why this is happening... it is using the same template for page2, page3 etc etc, which includes those queries. Below is my entire setup. Is there any way around this? I've tried using 'start' positions etc but doesn't seem to work properly. http://snippi.com/s/4ze4c4u (this is my entire setup for the news page) Any help or ideas? Many thanks.
  20. Let's say I have 500 Eventpages or more with differen content fields(date, title, textarea etc..). I would display all events in a list like this: $events = $pages->find("template=event, limit=10"); echo "<div class='event-container'>"; foreach($events as $event){ echo "<div class='event-detail'> <h1>$event->title</h1> <p>$event->short_description</p> </div>"; } echo "<a class='load-more'>LOAD MORE</a>"; echo "</div>"; Now I want to make the load-more link to display 10 or 20 more events without reloading the page and showing a loading gif/text while its rendering the other events, when clicking on it . How can i achieve this? I know that i could use pagination for displaying this heavy amount of results but the customer doesn't want that because it don't fit in the design of the website. Can I probably achieve a combination with Pagination and Ajax, or are there other ways to do it?
  21. Hi folks, I'm wondering if it is possible to create Previous/Next links between pages that only have a certain checkbox ticked? I have a Projects > each project structure setup, and if the user checks for a project to be a case study, it generates some new/different fields in the backend. What I'm after is to be able to have Previous/Next links per project that only cycles through the case studies... not all the projects. Here below is my code that works for ALL projects but not just CASE STUDY projects. Thanks for your time, R <?php /* $page->project_casestudy_check === 1 */ ?> <div class="project-casestudy-pagination-container clearfix"> <div class="container-fluid"> <div class="row"> <div class="col-xs-12 col-sm-12"> <?php if ($page->prev->id) : ?> <div class="prev-project-container"> <a class="prev-project" href="<?php echo $page->prev->url; ?>"><span>Previous Project</span></a> </div> <?php else : ?> <div class="prev-project-container"> <a class="prev-project" href="<?php echo $page->siblings->last->url; ?>"><span>Previous Project</span></a> </div> <?php endif; ?> <?php if ($page->next->id) : ?> <div class="next-project-container"> <a class="next-project" href="<?php echo $page->next->url; ?>"><span>Next Project</span></a> </div> <?php else : ?> <div class="next-project-container"> <a class="next-project" href="<?php echo $page->siblings->first->url; ?>"><span>Next Project</span></a> </div> <?php endif; ?> </div> </div> </div>
  22. Hi folks, I've set up some infinitescroll on manual trigger on a Journal section of my site, all fine and set up, but there's a slight issue that the 'Allow Page Numbers' isn't returning a 404 even when there isn't more 'pages'. So, the infinitescroll never fails... or stops. For example, I have a /journal/page1 which is fine, and has posts, and a /journal/page2 but then, technically, /journal/page3 shouldn't exist as all the last post is on page2, but even if I put /journal/page99 it still returns a page, rather than a 404. Looking at the tutorials, this is even the same for the tutorial: https://processwire.com/docs/tutorials/how-to-use-url-segments/page99 I know I need to build a throw new Wire404Exception(); into my template, but I am unsure how to manage this? Any thoughts? Thanks! R
  23. Hi fellow PW people. This is my 1st time posting here. Being a html and css front-end guy I’m virgin to CMS development but picking up the art of programming fast thanks the user intuitive and friendly ProcessWire which ended up being my CMS of choice after a month of experimenting among several. I’ve finally been presented with my first ‘unable to figure out’ problem… Ive been trying to tackle my head around a pagination problem. I am able to output the pagination however when you click on ‘page 2’ it directs to that page in the url, but the results don’t update. 'Page 2' outputs the results of 'page 1'. Also the navigation link stays on 'page 1' and the previous button don’t show. I have read through the API docs and also consulted other forum posts relating to pagination, trying out various different options to no avail. I have also enabled pagination in the templates used by the output pages. So I’m left scratching my head hoping some clever PW pro can help me figure this out. Below is the code used for the output. <?php foreach($results = $page->children("limit=6") as $child) echo " <div class=\"cottage-listing\"> <div class=\"image\"> <img src=\"{$config->urls->templates}/styles/images/examplecottage.jpg\" alt=\"Image of [cottage_name], [cottage_area]\"> </div> <div class=\"description\"> <p> <span class=\"cottage\"><strong>$child->title </strong>$page->title, {$page->parent->title} </span> <span class=\"information\">[cottage_summary] - Limited to 120 Chars</span> </p> </div> <div class=\"info\"> <span class=\"price\"><strong>from: £121</strong>per night</span> <dl> <dt>Type: </dt> <dd>{$child->cottage_type->title} | {$child->cottage_catering->title}</dd> <dt>Sleeps:</dt> <dd>{$child->cottage_sleeps}</dd> <dt>Rooms:</dt> <dd>{$child->cottage_bedrooms}</dd> </dl> <a href=\"{$child->url}\" class=\"button\">More Details</a> </div> </div> "; ?> <?php $pagination = $results->renderPager(array( // Controls the output of the pagination links 'nextItemLabel' => "»", 'nextItemClass' => "", 'previousItemLabel' => "«", 'previousItemClass' => "", 'listMarkup' => "<ul class='pagination'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>", 'currentItemClass' => "current", 'firstItemClass' => "", 'firstNumberItemClass' => "", 'lastNumberItemClass' => "", 'lastItemClass' => "" )); if ($pagination ==""){ echo ""; } else { echo "<div class=\"pagination-centered\"> $pagination</div>"; } ?> Any suggestions are welcome. It is probably something stupid staring me in my face, but after several hours trying to figure it out myself I'm turning to the super supportive forum before I start pulling my hair out (what's left of it) .
  24. Hi folks, I'm set up a simple next/prev between pages that are loaded in via pjax with the following: <?php if ($page->next->id) : ?> <div class="next-solution-container"> <a data-pjax class="next-solution" href="<?php echo $page->next->url; ?>"><span><?php echo $page->next->title; ?></span></a> </div> <?php endif; ?> This worked great, but I want it now to loop... so if it's the last item, it gets the first item as the next link. I thought the following below would work, but as I am using it on the page template, and thus using $page, I don't think first/last are in use? <?php if ($page == $page->last) : ?> <div class="next-solution-container"> <a data-pjax class="next-solution" href="<?php echo $page->first->url; ?>"><span><?php echo $page->first->title; ?></span></a> </div> <?php else : ?> <div class="next-solution-container"> <a data-pjax class="next-solution" href="<?php echo $page->next->url; ?>"><span><?php echo $page->next->title; ?></span></a> </div> <?php endif; ?> Any thoughts?
  25. How can I set "$config->pageNumUrlPrefix" as empty? So pages are for example "blog/2/" instead of blog/page2/". Thanks!
×
×
  • Create New...