Jump to content

Search the Community

Showing results for tags 'pagination'.



More search options

  • 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
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


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

Found 63 results

  1. 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
  2. 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...
  3. 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!
  4. 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
  5. 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
  6. 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
  7. 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?
  8. 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.
  9. Full disclosure: I'm starting in ProcessWire after having used MODX almost exclusively for the last four or five years. I still tend to think in terms of the parameters that I can set in a function call and, frankly, my knowledge of php has degenerated thanks to every need pretty much being covered by the snippet library there. I am trying to familiarize myself with ProcessWire by coding a simple gallery site (to work my way up to more complex sites as I get more comfortable). I've been able to look up everything I need between the cheat sheet, wiki and the existing forum topics until today. I have finally stumbled into something I can't quite work out (and can't figure out keywords with which to search). Staging site, the gallery in question: http://www.creativejay.com/xine/portfolio/ (I haven't finished setting up fancybox, that's fiddly stuff for later) In the portfolio I have three albums currently. Since these galleries will only grow, I want to add pagination now. I understand how to paginate with MarkupPagerNav and find(), which is how I retrieve the albums themselves, but the individual images in the album are retrieved with a double scoop of foreach. Here's the entire code of my function at the moment: <?php function galleryMain(){ $albums = wire("pages")->find("has_parent=/albums/"); echo "<div class='albumgrid'>"; $out =""; foreach($albums as $album) { $albumimages = $album->gallery; $thumbsize = 140; foreach ($albumimages as $albumimage) { $out .= "<a href='{$albumimage->url}' title='{$albumimage->description}' class='fancybox-button' rel='fancybox-button'>"; $out .= "<img src='{$albumimage->size($thumbsize, $thumbsize)->url}' style='margin-right: 15px; margin-bottom:25px; border: solid 1px #000000;' height='{$thumbsize}' width='{$thumbsize}'>"; $out .= "</a>"; } echo $out; } echo "</div>"; } ?> So what's happening above (as I understand it) is that it's fetching the children of /albums/ which results in three albums. It runs through each one "as $album" and within that it runs through all the items in the album's $gallery field, then loops back and repeats for each album. If I add my pagination limit in the initial find() call, it's actually just limiting the number of albums display. Since my desired thumbnail limit is 30 per page and there are three albums this is moot (aside from not being what I want). If I were to limit within the "as $album" call, or deeper, would it not limit the items displayed from each album, but not necessarily result in pagination in the resulting web page that would lead me to additional pages of thumbnails? So my question is: What syntax (and where) do I use to paginate the code above to display a maximum of 30 gallery thumbnail images, total, from three albums per page? Ideally I'd also like to order them so that the newest images appear first, exclusive of what album they are from. I should note I'm following the gallery tutorial from the wiki and I am more than happy to use different code in my function entirely if it achieves the goal more directly. Thanks a bunch in advance!
  10. 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?
  11. 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>
  12. 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
  13. 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) .
  14. 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!
  15. 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?
  16. How can I set "$config->pageNumUrlPrefix" as empty? So pages are for example "blog/2/" instead of blog/page2/". Thanks!
  17. 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.
  18. 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.
  19. 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
  20. 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
  21. 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
  22. 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.
  23. 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
  24. 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
  25. 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");
×
×
  • Create New...