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. 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
  2. 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) .
  3. Hi guys, am I doing something wrong? I get this selector $appuntamenti_privati = $pages->find("template=appuntamento_privato|appuntamento_cinema|appuntamento_cultura|appuntamento_gusto, start=11, limit=10, sort=-date, sort=title"); and then i get this at the end of the page <?php echo $appuntamenti_privati->renderPager(); ?> and i get a pagination rendered but it doesn't work correctly. I have only and always the "Prev"and it's always linked to page2 and, above all, every page shows always the same results (the first ten results). I can't get were the problem is. Thanks!
  4. 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?
  5. How can I set "$config->pageNumUrlPrefix" as empty? So pages are for example "blog/2/" instead of blog/page2/". Thanks!
  6. Hello, I want to paginate my keyword = value pages. This works well when I only paginate those pages: $fonts = $pages->get("/fonts/") But it stops working when I try to paginate $fonts = $pages->get("/fonts/")->find("keywords=mykeyword"); My pagination code looks like: $fontlist = $fonts->find("id>1, limit=6, draft=0, sort=-created"); $pagination = $fontlist->renderPager(array( 'nextItemLabel' => "▶", 'previousItemLabel' => "◀", 'linkMarkup' => "<a rel='prefetch' href='{url}'>{out}</a>")); echo $input->pageNum; foreach($fontlist as $font){ … “Allow page number” is checked on both fonts ant keywords templates.
  7. Hello developers, I am a newbie to Processwire CMS or CMF. I am stuck in using the TextFormatter module. I need to have pagination for a page, but this page has a header with a 1022*1024 image, so when click on next page, I get the repeated header image. Is there a way to remove the header image on clicking next.
  8. Hi, I have the following code in a template that lists all the child pages of that parent. I'd like to include Pagination so it would only show the title of 2 child pages per 'page'. I have completed the process here http://processwire.com/api/modules/markup-pager-nav/ however, I'm now a little unsure how to integrate this into my code below. I tried the example code in that page but to no avail. Can someone explain or point me in the right direction? Here is my current code: <?php if($page->numChildren) { echo "<ul class='nav'>"; foreach($page->children as $child) { ?> <?php echo $child->title; ?> <?php } echo "</ul>"; } ?> Many thanks for any pointers
  9. Hello, since this is my first post in the General Forum I want to take the chance to say thank you for Processwire. I really like what all of you have done so far and it makes backend development fun again . Now to the main topic. I attached a screenshot of how my paging is rendered, using the Pagination module. The issue is the spacing between my li tags. I want to achieve a 1px margin between them. Right now they are inline block with margin set to 0. Still I get the spacing. So the problem must be that the html which is rendered by the module is "pretty printed" So after each li there is a line break and some tabs. The space is actually is a "text space" if u will, an therefore now chance for me to get rid auf that space with css. Any tips on how to get around that? Cheers
  10. Hi Guys, I have a trouble with building PageArray. Actually I am running the selector on a log when an article is read. The template=history , with article field links to article template . When a user reads an article I log to history the time article read. Think something similar to facebook history . Now I am trying to get the history back. So what I am doing is $articles_history = $pages->find("template=history, limit=3"); $articles = new PageArray(); $articles->setLimit($limit); $articles->setTotal($articles_history->getTotal()); $start = ($input->pageNum - 1) * $limit; $articles->setStart($start); foreach ($articles_history as $article_history) { $articles->add($article_history->article); } $pagination = $articles->renderPager(array( 'currentItemClass' => 'active', 'listMarkup' => "<ul class='pagination'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>", 'separatorItemLabel' => "<span>…</span>" )); echo $pagination; There are a few troubles though when the article is same. The PageArray will add only once, and no more duplicates are added. That is one trouble. Now the actual trouble is the correct pagination is not coming. I wonder whether it is due to this reason. There is only total 10 articles with 2 being duplicates. I added a limit of 3. Then the pagination on first shows me 1, 2, 3, 4, 5. Not sure why though. Is there a way to fix this ? If you have thought of using the $articles_history then I could not because the templates are required :-/ and being used by other places. Something like partials. Thank you
  11. Hello, I've seen some code on the forum, but it doesn't seem to work for me, or I'm using it wrong. I'm after a simple way to find out how many pages there are for a certain pagination, or the last page number. Thanks.
  12. Hi guys, I have worked with pagination multiple times but seem to be having major issues as it is not showing at all. I have installed the module and selected page segments and allow page numbers within the template but still no joy. My structure is as follows; News Year Month Story My code is as follows on the news page. <?php $parent = $page->parent; $children = $page->children; $results = $page->find("template=news_story, limit=3, sort=-story_date"); $pagination = $results->renderPager(); ?> <?php foreach ($results as $child) { echo "<article><div class='blog-media banner-blog'> "; foreach($child->story_image as $images) { $images1 = $images->size(628, 227); echo "<img class='news-img' src='$images1->url' alt='{$image->description}'>"; } echo "<div class='tp-bannertimer tp-top'></div></div>"; echo "<h4><a href='$child->url'>$child->story_title</a></h4>"; echo "<ul class='no-bullet post-info'><li class='no-tag2'><i class='icon-clockalt-timealt'></i><span>$child->story_date</span></li></ul>"; echo "$child->story"; echo " <a href='$child->url' class='button small green'>Read More</a></article>"; } ?> <div class="pagination"> <?php echo $pagination; ?> </div> Any help would be greatly appreciated. Melissa
  13. Hi, trying to implemement a set of blog pages and started using the Pagination module to find I couldnt list the page=2 etc results. This is what I started with: This is on a blog template, of which the post template children have page number enabled. $results = $page->children()->find("limit=2, sort=-date"); $pagination = $results->renderPager(); echo $results->render(); This didnt produce different results when clicking 'next'. so I tried: $limit = 2; if($_GET["page"]==0){ $startNum = 1; }else{ $startNum = $_GET["page"]; } $start = ($startNum-1) * $limit; echo $start; $results = $page->children()->find("start=$start,limit=$limit, sort=-date"); $pagination = $results->renderPager(); echo $results->render(); And it works up to a point but then starts doing some crazy stuff! (like adding a new number for another list page which doesnt exist, e.g. page=4 when the limit only allows for 3 pages of list). any help would be amazing. b
  14. Is it possible to add pagination limit after merging to PageArrays? I'm querying pages for an event calendar where there are two conditions: Events that are starting in the future Events that started in the past but are ending in the future (aka are current) I've coded the following but I want to limit the results to trigger the pagination, but my code is not working. What can I do? $events = $pages->find("template=event, date>=today, sort=date"); $events = $events->append($pages->find("template=event, date<=today, date_end>=today,sort=date")); $events = $events->find("limit=15");
  15. I saw in a previous post (about a year ago) that pagination for repeaters was on the roadmap. Is this working yet or an eta? I'm hoping you'll chime in on this Ryan. Thanks! I'm currently working on a site where I have a repeater setup for a portfolio that filters the images by category. So in the repeater I have two fields (category - radio options, and image). But I also need to paginate through the images.
  16. today i use pagination found two questions and one is http://processwire.com/talk/topic/4751-sort-id-not-working/ and another question is the menu of all pages is missing. exclude first page. the menu code is wiritten in header.inc ,i use "include("./header.inc"); " get it. and this is the menu code: <?php $homepage = $pages->get("/"); $children = $homepage->children("limit=5"); $children->prepend($homepage); //index foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ''; $liclass=$child->numChildren(true) ? " class='hmp'" : ''; //get 2 menu //$finalstr=''; if($child->numChildren(true)) { $items=$child->children("limit=5"); $fstr="<div class='mc'> <ul>"; foreach($items as $item) { $fstr.="<li><a href='$item->url'>$item->title</a></li>"; } $fstr.=" </ul> <div class='ft'><b></b><i></i><div> </div></div> </div> "; } //end echo "<li$liclass><a$class href='{$child->url}'>{$child->title}</a>".$fstr."</li>"; } ?>
  17. Hey there. The pagination for my search isn’t working. I guess it has something to do with the merging of PageArrays beforehand. Take a look at the (simplified) search.php: $out = ""; if ( $q = $sanitizer->selectorValue( $input->get->q ) ) { $input->whitelist( "q", $q ); $pa = new PageArray(); $value = $pages->find( "title%=$q" ); $pa->import( $pages->find( "template=abc, …|…|…=$value" ) ); $pa->import( $pages->find( "template=abc, title%=$q" ) ); $result = $pa->find( "start=0, limit=4" ); $pagination = $result->renderPager(); $count = count( $pa ); if( $count ) { $out .= "<h2>Search results found</h2>"; $out .= "<ul>"; foreach( $result as $r ) { $out .= "<li>{$r->title}</li>"; } $out .= "</ul>"; $out .= $pagination; } else { $out .= "<h2>Sorry, no results were found</h2>"; } } else { $out .= "<h2>Please enter a search term in the search box</h2>"; } include("./head.inc"); echo $out; include("./foot.inc"); Pagination names are activated for the search template and the output of the pagination list is correct. When I go to "page2", "page3", etc. the result is always the very first 4 matches. Any help is appreciated, thanks! p.s.: I have to do the merging because one time I search for page references to a page (the "…" in the code) and one time for the title of a page with the template "abc". (offtopic: if you know a better solution to this just let me know)
  18. Hi, I have a problem getting pagination working with urlSegments. I read the docs and the forum, and another issue comes up with sort of the same thing. The problem there was that baseUrl got set by options and was left empty, while in the code below, the baseUrl is first set by the module manager (or something deep down..) Anyhow, the problem is: my urlSegments wont get rendered in the link. I have the template setup correctly and the strange thing is, only the first part of the urlSegments shows up. Strange eh? All the others are added via $queryString I think because I added them to $input->whitelist(); But I'm not sure if this is necessary. Is it correct that normally, it would work out of the box because the urlSegments are part of the baseUrl? And, if I read the code in MarkupPageArray.module line 146, where the baseUrl is set by default, I read: if(empty($options['baseUrl'])) $pager->setBaseUrl($this->page->url . ($this->page->urlSegment ? $this->page->urlSegment . '/' : '')); This seems wrong and the reason only the first urlSegment gets added. Or, should $page->urlSegment contain all segments? And if it doesn't what could be the problem? (btw: maxUrlSegments=4, default)
  19. i've used "Example 3: Display a different language based on URL pre-segment" from the guide to make a site multi-language capable.. my language gateway looks like: <?php $user->language = $languages->get($page->name); $path = '/'; foreach($input->urlSegments as $segment) { $path .= $segment . '/'; } $mypage = $pages->get($path); if(!$mypage->id || !$mypage->viewable()) throw new Wire404Exception(); //replace local navigation links $out = $mypage->render(); $regex = '{(<a [^>]*href=["\']' . $config->urls->root .')(["\']'; $topnav = $page->parent->children(); foreach($topnav as $p) $regex .= "|" . $p->name; $regex .= ")}"; $out = preg_replace($regex, '$1' . $page->name . '/$2', $out); echo $out; the regex works quite well for everything else, but but kind of skews up on the 'blog/news' page which uses pagination. besides the fact that the pagination links end up as 'site.com/blog/blog/page2' instead of 'site.com/blog/page2', even when manually entering 'site.com/blog/page2', 4040 error is thrown. I'm guessing that things go bad here: $mypage = $pages->get($path); if(!$mypage->id || !$mypage->viewable()) throw new Wire404Exception(); since "path/to/page/page2" will not not return a page. Also, removing the "throw new 404" line, I end up with a blank page. Any suggestions? Thanks,
  20. I'm currently working on a site that includes a blog. Individual blog posts can be assigned multiple "categories" using a Page field type in the post that references pages using the "category" template. When I perform the following, the correct posts are displayed on each category page: $posts = $pages->find( "parent=/blog/, template=post, categories=$page->name, start=0, limit=20, sort=-date" ); But, when I modify the code to limit the number of posts that are displayed, the same two posts display on every paginated page within a category: $posts = $pages->find( "parent=/blog/, template=post, categories=$page->name, start=0, limit=2, sort=-date" ); My "category" template is set to "Allow Page Numbers" and the pagination is displaying on each paginated category page. But any posts beyond the first two never display. It has been a long working Sunday and I'm sure that whatever I'm doing wrong is silly, but I'm too tired to see it!
  21. Hi everyone, Sometime since I posted something here, but I can't seem to be able to surpass this problem on my own. I've read a bunch of topics that relate to this problem but nevertheless, I fail to fix this pagination display. Let me explain and hope someone help me out. This is my current structure: Home CatalogCatalog (subpage, same type)Product 1 Product 2 ... Product N The script is triggered in the first 'Catalog' in the tree above. The template of this script is similar to the default search.php, where the results are packed into the $out variable and dumped at the end. I don't believe this has anything to do with my problem. At the beginning I have: $query = "limit=3"; $products = $page->get("name=produtos")->children($query); $count = count($products); It returns the correct number of items, and displays the first 3. At the end, I have the pager rendering: echo $jogadores->renderPager(); And it displays the correct number of pages. However, clicking one of the links, the page refreshes with a new URL, but with the same three results. The URL looks like this example for page 3: /path/to/url/page3 I have turned the "Allow Page Numbers?" on the 'catalog' template, so it should work. Thanks in advance!
  22. Does anyone know how to translate properly the words "Prev" and "Next" that are rendered with Processwire's paginator feature? Thanks!
  23. Hi. This code is not working. How can I render pagination in Modules? public function ___execute() { ...... $news_list = $this->pages->find('template=news-page,limit=1,sort=-created'); ...... $out .= $news_list->renderPager(); ...... }
  24. Hi there, Looking for advice around an approach to a requirement. I have the following existing page paths: Gallery -> Category ---------- /gallery/ladies/ Albums -> AlbumName ----- /albums/jane/ /gallery/ladies/ will list as many album entries that are categorised as 'ladies'. The template supports pagination numbering. The link to the 'jane' entry has been formed as follows: /gallery/ladies/jane/ - obviously, in addition to the template supporting pagination numbering, it also supports URL segments. Here is where I need some advice. The album page 'jane' is only a single page but, it has an images collection that may have, say, 30 images. I want to turn jane's images into 'Pages', say, two images per page. Therefore, there are 15 "pseudo-pages". However, PW pagination works against find()'s that return PageArrays whereas in my case, it won't actually find 15 physical pages. The desired outcome would be: /gallery/ladies/jane/ /gallery/ladies/jane/page2 /gallery/ladies/jane/page3 /gallery/ladies/jane/page4 ... Is this possible and if so, any suggestions how to approach this? Thanks!
  25. Hi there, Before Soma jumps all over me, I've searched through the many threads that involve pagination I've set things up as per the main Pagination article. When I click on the Next link, I get the existing page re-rendered. The URL at this stage says: http://localhost:888...re/news/?page=2 I'm not clear whether I should be checking the page number and only processing certain items in the find() or whether the find() internally observes the page number internally. It's worth pointing out the news is the parent page that summarises news items from a collection of child pages. Any ideas what might be going wrong here? Thanks.
×
×
  • Create New...