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'm trying to build a search module. See my rep here https://github.com/dtjngl/simpleSearch.git Once installed, you should be able to test it, just make sure you adjust $this->indexedCategories in the module's init() function. (I will change this later to be defined in the module's config file instead.) Then use the public functions to render the different parts of the search page: echo '<div id="filters">'; echo $simpleSearch->renderFilters(); echo '</div>'; echo '<div id="criteria">'; echo $simpleSearch->renderCriteriaMarkup(); echo '</div>'; echo '<div id="paginationstring">'; echo $simpleSearch->renderPaginationString(); echo '</div>'; echo '<div id="overview">'; echo $simpleSearch->renderOverviewMarkup(); echo '</div>'; echo '<div id="search-results">'; echo $simpleSearch->renderResultsMarkup(); echo '</div>'; echo '<div id="pagination">'; echo $simpleSearch->renderPaginationMarkup(); echo '</div>'; The problem with the pagination: $this->renderResultsMarkup() the entries seem to paginate alright $this->renderPaginationString() the entries seem to paginate alright $this->renderPaginationMarkup() pagination links DON'T show up at all! I don't know what I'm still not getting about pagination and what I'm doing wrong. When do I fetch and where do I store all the results? And at which point do I paginate the results? It just never makes sense to me. Any help and advice is much appreciated.
  2. $limit = 12; $start = $limit * ($input->pageNum() - 1); $allcasts = pages("template=cast"); $casts = $allcasts->find("has_parent=$page, sort=$sort"); $casts = sortOutEmpty($casts, $decider); $casts->setTotal($casts->count()); $casts->setStart($start); $casts->setLimit($limit); // just to test echo $casts->getStart(); // 0 or 12 or 24 or 30 respectively echo $casts->getLimit(); // 12 echo $casts->getTotal(); // 31 or whatever the total echo casts($casts); // never mind this, it's just for markup creation and works fine $pager->render($casts, $pagerOptions); // I store the name of a specific field as a string in a variable so I can dynamically sort out content of which that field is empty in the current language function sortOutEmpty($items, $decider) { $casts = new PaginatedArray; foreach ($items as $item) : if ($item->$decider != '') : $casts->add($item); endif; endforeach; return $casts; } I get the right number of pages in the pager. Pager works but the results never paginate. This pagination API is driving me nuts, it just doesn't work! I can't be the only one who's having issues with this, it's hard to find any topic where issues are discussed and the API-documentation is, as usual, very laconic. Thanks for help!
  3. 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.
  4. I'm having and always have a hard time building PaginatedArrays, I never know where to put the "limit=24" selector so please enlighten me. Here's what I'm doing… $categories = $page->protable('start=0, limit=999999'); // this I need in order to retrieve the pages's "categories" and I don't know how to make use of $rows instead for that purpose because of this confusing limit-API $rows = $page->protable; // put ("limit=20") here? $custom = buildSelector($input, $rows); // this function returns an array of selectors depending on the user input $items = new PaginatedArray; // or here? // or here? $items->find("limit=20") // or like this? $items("limit=20") // or like this? $items = $items("limit=20") // or like this? $items = $items->find("limit=20") foreach ($rows as $r) : if ($custom->get('selector')->matches($r)) : $items->add($r); endif; endforeach; // or at this point? and then if ($items) { // or maybe somewhere here? echo '<span class="grey">'.$items->getPaginationString(array( 'label' => 'entries', 'zeroLabel' => '0 entries', // 3.0.127+ only 'usePageNum' => false, 'count' => count($items), 'start' => $items->getStart(), 'limit' => count($items), 'total' => $items->getTotal() )); and then of course… $pager = $modules->get("MarkupPagerNav"); echo '<div class="uk-flex uk-flex-center">'.$pager->render($items, $options).'</div>'; I'm out of ideas and confused cause it doesn't make sense to me either way. ____ The buildSelector function above returns and array… $selected = new Selectors("$letter, $searchterm, $category"); $custom = new Wirearray; $custom->set('selector', $selected); $built->set('sort', $sort); return $custom; and each of the new selectors are basically strings ("category=whatever") Also, you cannot put the "sort=title" or whatever as a selector for the Selectors function (see above). Why, I know not. I don't know if that is the proper way but selecting kind of works now as opposed to many other ways I tried. Selectors always require a lot of trial and error, it seems to have a very sensitive API, always depends on double quotes, single quotes and how you concatenate. Thanks for help!
  5. Hi, I am trying to style the pager navigation bar based on a simple example I found on bootstrap: <nav aria-label="..."> <ul class="pagination"> <li class="page-item disabled"> <a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a> </li> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item active" aria-current="page"> <a class="page-link" href="#">2</a> </li> <li class="page-item"><a class="page-link" href="#">3</a></li> <li class="page-item"> <a class="page-link" href="#">Next</a> </li> </ul> </nav> The code I am using is the following: <?php echo $entries->renderPager(array( 'nextItemLabel' => "Next", 'previousItemLabel' => "Prev", 'listMarkup' => "<ul class='pagination'>{out}</ul>", 'itemMarkup' => "<li class='page-item'>{out}</li>", 'linkMarkup' => "<a class='page-link' href='{url}'>{out}</a>", 'currentItemClass' => "page-item active", )); ?> which renders this result: the current page is not styled! If I run the original bootstrap example everything works fine, but not through the renderPager options. The problem seems trivial but since I am new to ProcessWire (also to web design) I cannot find it! My main reference is this one. Thanks in advance!
  6. Hi, I am having problems controlling the pagination in ProcessWire. More specifically, how it displays the url. Normally, '/page2/' etc is appended to the url when using pagination. However, I am seeing all of my get vars (used for a search form) appended as well eg: '/page2/?dropdown_select_1=&dropdown_select_2='. I am using $input->whitelist facility to build a search form that exists on all pages on the site. I am not sure how to clear this specifically for the pagination url to look cleaner. My code fore the pagination is as follows: $pagination = $articles->renderPager( array( 'nextItemLabel' => 'next', 'previousItemLabel' => 'prev', 'listMarkup' => "<ul class='pagination'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'><span>{out}</span></a>", 'currentItemClass' => 'current', 'getVars' => null ) ); As you can see, I have tried to use the 'getVars' property to (incorrectly it seems) clear the get variables. I'm using ProcessWire 2.2.9
  7. Hello si have this gallery, pretty good website, but yesterday client uploaded over 3000 images oto the site, and it cannot handle filtering them out and showing them at the same time , i wanted some simple pagination maybe infinite scrool or onclikc load whatever, but i cannot seem to implement infinite ajax scrool and any other JS methods, nut sure why i still got stuck at the next method, like there is not next page. so i wanted to implement PW method of paginating i wanted to use MarkupPagerNav so far i have this code for outputting images $pa = $pages->find("template=basic-page|art_gallery, images.tags!=''"); /* $pa = $pages->find("has_parent!=2,id!=2|7,status<".Page::statusTrash.",include=all"); */ echo "<div class='js-filter' id='gal' >"; /* row gtr-50 gtr-uniform */ $frame = $pages->get('/settings/')->watermark; foreach ($pa as $p) { foreach($p->images as $image) { if(!$image->hasTag("act")) { $options = array('quality' => 80, 'upscaling' => true, 'cropping' => 'north', 'sharpening'=>'medium'); $large = $image->size(1200, 0, $options); $wmImage = $large->pim2Load('wm1', ['quality'=>80, 'upscaling' => true, 'sharpening'=>'medium', 'defaultGamma'=>-1])->watermarkLogo($frame, $position='se',$padding=1.5)->pimSave(); /* zmazanie variacii, treba odpoznakovat ked sa menia nastavenie vyssie */ /* $image->pim2Load('wm1')->removePimVariations(); */ $thumb = $image->size(400, 300, $options); echo "<div class='$image->tags grid-item' style=''>"; echo "<span style='overflow:hidden;'class='image fit'>"; echo "<a class='hvr-reveal' href='$wmImage->url'>"; echo "<img uk-scrollspy='cls: uk-animation-fade; repeat: false' src='$thumb->url' alt='$image->tags'>"; echo "</a>"; echo "</span>"; echo "</div>"; } else { $options = array('quality' => 80, 'upscaling' => true, 'cropping' => 'north', 'sharpening'=>'medium'); $large = $image->size(1200, 0, $options); $wmImage = $large->pim2Load('wm2', ['quality'=>80, 'upscaling' => true, 'sharpening'=>'medium', 'defaultGamma'=>-1])->pixelate(25)->smooth(255)->watermarkLogo($frame, $position='se',$padding=1.5)->pimSave(); /* zmazanie variacii, treba odpoznakovat ked sa menia nastavenie vyssie */ /* $image->pim2Load('wm2')->removePimVariations(); */ $thumb = $image->size(400, 300, $options); echo "<div class='$image->tags blur grid-item' style=''>"; echo "<span style='overflow:hidden;'class='image fit'>"; echo "<a class='hvr-reveal' href='$wmImage->url'>"; echo "<img uk-scrollspy='cls: uk-animation-fade; repeat: false' src='$thumb->url' alt='$image->tags'><span>18+</span>"; /* <span>BY OPENING THIS IMAGE YOU CONSET THAT YOU'RE 18 YEARS OR OLDER</span> text copyraightova,y dat vedla obrazky potom */ echo "</a>"; echo "</span>"; echo "</div>"; } } }; to put it simply, it first searches for sites, and then outputs all images from those sites, pretty simple, it also uses watermarking and uikit filtering i have filtering done like this $num = 1; echo "<ul class='uk-subnav uk-subnav-pill'>"; foreach(array_unique($alltags) as $key => $tag) { echo"<li uk-filter-control='filter: .$tag;group: $num' class='butt$num' uk-toggle='target: .butt$num ; animation: uk-animation-fade; queued: true'><a href='#'>$tag</a></li>"; echo"<li uk-filter-control='group: $num' class='butt$num active' aria-hidden='true' hidden='' uk-toggle='target: .butt$num; animation: uk-animation-fade'><a href='#'>remove - $tag</a></li>"; $num++; } echo "</ul>"; simple, but i have NO idea how to implement pagination, just because it seems to work that it like find all images, and stores with limit, and then just paginates them, but i cannot apply this method in my code. any idea how to make any JS inifite scroll work ? or just how to make this work ? with my setup, or with some modifications, it just have to work as is now
  8. I will preface this by saying I have checked (multiple times) per template (both parent and child, to be totally sure) that they are set to allow pagination. What's happening is that my first page of results keeps displaying, despite /page2/ being in the URL. The pagination markup also indicates I am still on page one. This is happening across multiple types of paginated pages. $pagination = $pager->render($results, $poptions); The options are just markup... $poptions = array( 'numPageLinks' => 5, 'listClass' => 'uk-pagination', 'linkMarkup' => "<a href='{url}'>{out}</a>", 'currentItemClass' => 'uk-active', 'separatorItemLabel' => '<span>&hellip;</span>', 'separatorItemClass' => 'uk-disabled', 'currentLinkMarkup' => "<span>{out}</span>", 'nextItemLabel' => '<i class="uk-icon-angle-double-right"></i>', 'previousItemLabel' => '<i class="uk-icon-angle-double-left"></i>', 'nextItemClass' => '', // blank out classes irrelevant to Uikit 'previousItemClass' => '', 'lastItemClass' => '', ); In the header, I call for the module and the options include: $pager = $modules->get('MarkupPagerNav'); include_once("pagination.inc"); Aside from the usual "check that you allowed pagination" advice, what issue might these symptoms indicate?
  9. Hello all, using PW 3.0.148 with the regular site profile for a blog, I got an an empty pagination output when I had a Toggle field in the selector. The Toggle Fieldtype was introduced with https://processwire.com/blog/posts/pw-3.0.139/ . The selector resulting in empty pagination: $posts = $pages->find("parent=blog, sort=-date, limit=10, toggle_field=0"); It worked well, when I replaced the Toggle field with a Checkbox field: $posts = $pages->find("parent=blog, sort=-date, limit=10, checkbox_field=0"); So the prerequisites for the pagination to work are given. The settings for the Toggle field were: Formatted value: Integer Label Type: Yes/No Input Type: Toggle buttons Default selected option: No Thanks for any hints!
  10. Hi all, I've set up a filter on my product-page, which I then use to...filter my products! – I've got pagination set up, and 30 items per page. – When I active the filter it works perfectly (in my opinion). Here's what I'm struggling with though: When I'm on another page (filtered as well/or the total overview) and I put my GET request in for the filter, it gives back the result, but still with the page-number there. In some cases, this is no problem – like a A-Z or Z-A filter, but others (say, per location) I might have less pages. Visual/code ref: (I DO have 3 pages of authors, but I don't have 3 pages from London) url: books/page3?author=ascending url: books/page3?studio=london The current setup for my pages that get rendered are as follows: $allbooks = $pages->find("template=book, sort=$sort, $q, $tagged, $select_studio, start=0, limit=$limit"); As you can see I have the start=0 in there, but I read that's for the start of the pagination, not so much where it'll drop me in the search results. $q, $tagged and $select_studio are all empty values, unless they're returned from the GET request To repeat it, in it's most simplest form: When I click a filter, and a GET request is done, I want to 'reset' the page-number to 0, and get my results... Perhaps I'm missing something obvious, but I'd be really grateful to have your input.
  11. I have a series of videos, and the following search form (translated into English here) that allows to filter these videos on the frontend: I've built a few of these search forms, but only with text fields, selects and radio buttons. Here I'm using an array with checkboxes ("Level" field above), and it's causing me grief when I try to paginate these results. I've done a lot of searching in the forum and spent too many hours to try to get it to work. Here's how I'm building the selector: <?php if(count($input->get)): // Level is an array. Code adapted from Ryan's snippet here: // https://processwire.com/talk/topic/3472-enable-pagination-for-search-results/?tab=comments#comment-38042 if($input->get->level) { $level = array(); foreach($input->get->level as $id) $level[] = (int) $id; // sanitize to INTs $level = implode('|', $level); // convert to 123|456|789 string, ready for selector } else { $level = ''; } $data = array( 'training_type' => array('=', (int) $input->get->training_type), 'duration' => array('=', (int) $input->get->duration), 'level' => array('=', $level), 'limit' => array('=', (int) $input->get->limit) ); $selector = ''; // iterate through the $data we made above to create a selector string foreach($data as $field => $a) { list($operator, $value) = $a; if(empty($value)) continue; // send value to the whitelist so that it can be used in pagination $input->whitelist($field, $value); // append to our selector string $selector .= "$field$operator$value, "; } $videos = $page->children("$selector"); When I hit search, I get the expected results. So far so good. The GET parameters are the following with the options selected in the screenshot above: videos/?level[]=1476&level[]=1477&training_type=1473&duration=1485&limit=10 $selector echoes the following as the "level" field is an array with a pipe character: level=1476|1477, training_type=1473, duration=1485, limit=10 Now, when paginating these results, the following page (page 2) shows these GET parameters: videos/page2/?level=1476|1477&training_type=1473&duration=1486&limit=10 And I think that's where the problem lies. The "level" field is "lost" and I'm getting more results than expected on subsequent pages. If I manually add "page2" to the initial results in the URL, just to test, everything works fine: videos/page2/?level[]=1476&level[]=1477&training_type=1473&duration=1486&limit=10 But how can I achieve this in code? Do I need to revert to "level[]=1475&level[]=1477" instead of "level=1476|1477" for the pagination to work correctly, and can you PHP gods illuminate me? Any help would be really appreciated, really.
  12. Hi everyone, I'm working on a CLI script that renders paginated pages. Therefore I iterate trough paginated pages and set the page number and render the result. My problem is, after calling the render function for the first time, the output doesn't change even if I change the page number. DEMO: I'm using a template that renders a pagination of its children: <?php echo $page->children("limit=3")->render(); ?> I can view the paginated results in the Browser: /page-rendering-pagination/ /page-rendering-pagination/page2 /page-rendering-pagination/page3 ... When trying to render the different pages using the API I always get the first result, even if I change the page Number. <?php namespace ProcessWire; include('./index.php'); wire('input')->setPageNum(1); $p = wire('pages')->get('/page-rendering-pagination'); var_dump($p->render()); // renders first three items wire('input')->setPageNum(2); var_dump($p->render()); // also renders the first three items Am I missing something? Is there some kind of caching mechanism that I'm not aware of? Thanks for your help.
  13. Quick question: Is it possible to use PW's pagination for other things than PageArrays? i.e. query custom database tables and paginate the results? Has anyone ever tried it?
  14. Greetings, I've created a product database which all use the template product.php and are published on the website. I'm trying to create an overview table with pagination of all the products, but using $pages->get does not return an object, only the object title. $products = $pages->get("template=product, limit=10"); This returns 10 strings in the frontend but not the object. When looping over the result set to get product fields, i get the following error: Notice: Trying to get property 'title' of non-object Because the product database is fairly large, i've added a pagination using the same query and this does return all the pages, but i can't click on the links that the paginator renders. $results = $pages->find("template=product, limit=10"); if($results->getTotal() > 10) { echo $results->renderPager(array( "nextItemLabel" => "Volgende", "previousItemLabel" => "Vorige", "currentItemClass" => 'active' )); } I've added the option in the template to allow page numbers. When i navigate to the link manually, i still end up seeing the 10 first products. I've tried changing several settings around, but i'm a bit stuck on how to resolve these issues. Do you have any advice what I need to adjust? Thanks in advance for your feedback.
  15. Hello Community ? Has anyone ever tried having multiple elements on one page that get their info with $pages->find('selector, limit=n') and tried using pagination on one of these elements without effecting the other? I have a slider on a page where I display content with pagination. But when I go to page two, the slider content also goes to page two, which I don't want it to do ? Any tips are greatly appreciated! Thanks! -Peter
  16. Hello ? I have set up pagination on a mulitlanguage site. I've done this before, but this time I have a problem I can't solve. Pagination is activated on 'parent-template' and 'child-template' just to be sure ? This is my code: $children = $page->children('limit=1'); foreach($children as $child) { $title = $child->title; echo $title; } echo $children->renderPager(); The navigation is output correctly and the link look correct as well 'parent-page/page2/'. But when I click the link, the site seems to redirect back to 'parent-page/ Any help would be greatly appreciated ? - Peter
  17. Hello everyone! I have a problem with pagination. I have following code: <div class="uk-section"> <?php $results = $pages->find("template=gallery, limit=10, sort=title"); $pagination = $results->renderPager(); echo $pagination; echo "<ul class='uk-pagination uk-flex-center'>"; foreach($results as $result) { echo "<li><a href='{$result->url}'>{$result->title}</a></li>"; } echo "</ul>"; echo $pagination; ?> </div> Which works fine. And this markup results in following html code: <div class="uk-section"> <ul class='uk-pagination uk-flex-center'> <li> <a href='/galerie-bisheriger-projekte/'>Galerie bisheriger Projekte</a> </li> <li> <a href='/galerie-bisheriger-projekte/galerie-1/'>galerie-1</a> </li> </ul> </div> But instead of "Galerie bisheriger Projekte" and "galerie-1" I want to have a number. And as last question, how can I add a previous and next button? Thanks for your help!
  18. Good morning everyone! I have a growing number of posts about cars, bikes, airplanes, etc. The following code (below) just works fine and returns only the posts of the category=cars as I desired together with pagination. In my url I have for example /categories/cars/car1 or /categories/bikes/bike1 I do want to filter my posts not only with ... category=cars ... but also with category=bikes or category=airplanes and at best: If my url is /categories/bikes/ then ... category=cars ... should be overwritten or replaced by ... category=bikes ... If my url is /categories/airplanes/ ... then the filter should be ... category=airplanes ... (I know a work around by creating almost identical templates where I could just change the "category=cars" part of my code but that's comes of a prize by repeating a lot of identical code and is not a good habit). In the documentation I read something about the "has_parent" selector but I could not get to work it related to the urls mentioned above. <?php foreach ( $results = $pages->find('id>1, template=templateblogpost, category=cars, limit=5, sort=-postdate') as $post ??> <!-- Blog entry --> <div class="g8-card-4 g8-margin g8-white"> <!--<img src="/g8images/bridge.jpg" alt="Norway" style="width:100%">--> <div class="g8-container"> <h3><b><?= $post->title; ?></b></h3> <h5>Datum: <span class="g8-opacity"><?= $post->postdate; ?></span></h5> </div> <div class="g8-container"> <p><?= $post->posteditor; ?></p> <div class="g8-row"> <div class="g8-col m8 s12"> <p> <a href="<?= $post->url; ?>"><button class="g8-button g8-padding-large g8-white g8-border"><b>Details lesen &raquo;</b></button></a> </p> </div> <div class="g8-col m4 g8-hide-small"> <!--<p><span class="g8-padding-large g8-right"><b>Comments &nbsp;</b> <span class="g8-badge">2</span></span></p>--> </div> </div> </div> </div> <!-- END BLOG ENTRIES --> <?php endforeach; ?> <? echo $results->renderPager(array( 'nextItemLabel' => "rückwärts", 'previousItemLabel' => "vorwärts")); ?>
  19. Hi all, Quick question as I haven't found anything from my Googling. I have a blog on the site which utilises pagination. On the standard blog page I have a custom header which has featured posts. Below that I then have recent posts like mosts blogs. Now if i click to page two or three I want the header to disappear and just show a continuation of the standard posts. I'm not sure how to go about this so any direction would be helpful. Thanks
  20. Hi guys, I just found out about Page Table module, which i'm currently using as a replacement for repeater module. Is there any way I can add pagination, and numbering for better and easier administration. Thanks
  21. 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.
  22. Hey everyone, I'm pretty experienced with pagination and haven't seen this before. I have my pages pulled using $pages->find, which is working fine however using renderPager() generates pagination where the links do not work. Here are some details. All templates needing pagination have pagination enabled in the admin. URL Segments are not enabled. Clicking on the "Next" or numbered links merely reloads the current page. The link href values are properly being output with the urls being /page2, /page3, /page4, etc. Manually entering the paginated urls has the same effect of reloading the current page with no new content. Pages are being returned from the ->find function properly and with the proper limit. A few other details: ProcessWire v3.0.98 Multi-language is enabled, 2 languages implemented. Pagination does not work on either language Have very few modules installed (few enough to list), none of which I could see interfering: ProFields, ProDrafts, ListerPro, DB Backups, Cronjob DB Backup, Upgrades, Upgrade Checker, Force Password Change, Markup Sitemap XML I'm stumped. For the sake of being overly-thorough, here's the code: <?php $articleTemplates = [ 'template_news_article', 'template_news_video', 'template_news_press_release' ]; $searchParams = [ 'template=' . implode('|', $articleTemplates), 'sort=-published', 'limit=' . $pages->get('template=template_news')->list_count ]; $articles = $pages->find(implode(',', $searchParams)); echo $articles->renderPager(); ?>
  23. Hello, sure there is something stupid im doing here but cant seem to get the pagination to work. The page list appears but clicking on any of the next template has Allow URL segments? checked and contains: $results = $page->children("limit={$limit}"); $pagination = $results->renderPager(); $out .= "<section class='blog-posts'>"; foreach($results as $result) { $out .= "<h3><a href='{$result->url}'>{$result->title}</a></h3>"; } $out .= $pagination;
  24. I'm using pagination but I want to place a summary text somewhere in the template. Basically my query has a limit=20 so somewhere on the page I want to say something like "Showing 21 through 40 of 290 results". I can get the total results by doing my query again with $pages->count() unless this is not performant? But how do I know that I'm viewing 21-40 results? And on the last page where it might not be returning a full 20 pages, it would probably say something like "Showing 281-290". I thought I could just do some math using the $input->pageNum and then calculating based on my limit=20. This just seems messy somehow. I'm looking for a better way unless there is no better way. Thanks
  25. Has anyone used pagination with ajax driven content? I'm using the MarkupPagerNav module to give me pagination, but my content is updated by an ajax post to refresh the body content of a table. The pagination links show a myproject/http404/?page=n for each link generated so they give a 404 page not found. I believe this is because the file containing my ajax code resides in the root of my project as a "web service" and does not have the access it needs, but I'm unsure really. If anyone can throw any light on this I would be very grateful. I include the code with my ajax below. <?php namespace ProcessWire; require_once ('./index.php'); // bootstrap ProcessWire if($config->ajax) { $pg = $pages->get("/single-use-carrier-bags/"); $selector = wire('input')->post('selector'); $mytableContent = ''; // hold the table markup // $retailer = $pg->children($selector); // for info. only $selector looks like this -> $retailer = $pg->children("sort=title, include=all, limit=10"); $pageinate = $retailer->renderPager(); echo $pageinate; foreach ($retailer as $r) { $mytableContent .= "<tr> <td><a href= '$r->url' target='_blank'>$r->title</a></td> <td>$r->category</td> <td>".numFormat($r->no_bags_issued)."</td> <td>".numFormat($r->gross_proceeds)."</td> <td>".numFormat($r->net_proceeds)."</td> <td>$r->other_use_net_proceeds</td> <td>".numFormat($r->amount_donated)."</td> <td>$r->good_causes_in_receipt</td> <td>".numFormat($r->no_paper_bags_issued)."</td> <td>".numFormat($r->no_bags_for_life)."</td> </tr>"; } echo $mytableContent; } ?>
×
×
  • Create New...