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 66 results

  1. 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
  2. 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
  3. 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");
  4. 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.
  5. 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>"; } ?>
  6. 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)
  7. 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)
  8. 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,
  9. 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
  10. 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!
  11. Does anyone know how to translate properly the words "Prev" and "Next" that are rendered with Processwire's paginator feature? Thanks!
  12. 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(); ...... }
  13. 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!
  14. 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.
  15. Hi guys, have been having an issue with pagination. It's a bit odd, I have it working fine as per Ryan's docs but when I get to a page2 of results, my categories don't display. I should add that my categories are generated at the top of the page in their own loop. The template also uses urlSegment to filter the results by category. I have added pagination to both the news template and also the categories template which get's called through urlSegment. On the main news page, pagination works but the categories come up empty when on the 2nd page. On the categories template, the pagination won't show at all, and I'm not sure why as it's pretty much an identical setup to the news template. Here's all the code, in case any of you can make sense of it.... Thanks. News index : <?php include("./header.inc"); ?> <div id="news_index" class="grey_gradient"> <?php if ($input->urlSegment1 !="") { include ("./categories.php"); } else { ?> <div id="news_top_bar"> <h5 id="news_header">Recent news items</h5> <?php $news_cats = $pages->find("template=news_category"); if ($news_cats) { ?> <ul id="news_cats"> <li>By category: </li> <?php foreach ($news_cats as $cat) { $numArticles = $pages->count("template=news_entry, news_category_link=$cat"); if ($numArticles > 0) { ?> <li><a href="<?php echo $page->url . $cat->name; ?>"><?php echo $cat->title; ?></a> / </li> <?php } ?> <?php } ?> </ul> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /#news_top_bar --> <?php $news = $page->children("sort=-created, limit=3"); foreach ($news as $entry) { $class = "news_box"; if ($entry == $news->last()) { $class .= " news_box_last"; } ?> <div class="<?php echo $class; ?>"> <div class="news_index_text"> <h3><a href="<?php echo $entry->url; ?>"><?php echo $entry->title; ?></a></h3> <h6><?php echo $entry->entry_date; ?> by <?php echo $entry->createdUser->first_name . " " . $entry->createdUser->last_name; ?></h6> <?php if ($entry->summary) { echo "<p>" . $entry->summary . "</p>"; } else { $body_text = strip_tags($entry->body); $text = substr($body_text, 0, 300); echo "<p>$text...</p>"; } ?> <a href="<?php echo $entry->url; ?>" class="button">Read on</a> </div><!-- /.news_index_text --> <?php if ($entry->main_image) { $news_image = $entry->main_image->size(240,180); ?> <img src="<?php echo $news_image->url; ?>" width="<?php echo $news_image->width; ?>" height="<?php echo $news_image->height; ?>" alt="<?php echo $entry->title; ?>" class="small_frame" /> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /.news_box --> <?php } ?> <?php // PAGINATION LINKS $pagination = $news->renderPager(); echo $pagination; ?> <?php } ?> </div><!-- /#news_index --> <?php include("./footer.inc"); ?> Categories.php : <?php $name = $sanitizer->pageName($input->urlSegment1); $category = $pages->find("template=news_category, name=$name"); $news_cats = $pages->find("template=news_category"); ?> <div id="news_top_bar"> <h5 id="news_header">Recent news items - <?php echo ucwords($name); ?></h5> <?php if ($news_cats) { ?> <ul id="news_cats"> <li>By category: </li> <?php foreach ($news_cats as $cat) { $numArticles = $pages->count("template=news_entry, news_category_link=$cat"); if ($numArticles > 0) { ?> <li><a href="<?php echo $page->url . $cat->name; ?>"><?php echo $cat->title; ?></a> / </li> <?php } ?> <?php } ?> </ul> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /#news_top_bar --> <?php $news = $pages->find("template=news_entry, news_category_link=$category, limit=1"); foreach ($news as $entry) { $class = "news_box"; if ($entry == $news->last()) { $class .= " news_box_last"; } ?> <div class="<?php echo $class; ?>"> <div class="news_index_text"> <h3><a href="<?php echo $entry->url; ?>"><?php echo $entry->title; ?></a></h3> <h6><?php echo $entry->entry_date; ?> by <?php echo $entry->createdUser->first_name . " " . $entry->createdUser->last_name; ?></h6> <?php if ($entry->summary) { echo "<p>" . $entry->summary . "</p>"; } else { $body_text = strip_tags($entry->body); $text = substr($body_text, 0, 300); echo "<p>$text...</p>"; } ?> <a href="<?php echo $entry->url; ?>" class="button">Read on</a> </div><!-- /.news_index_text --> <?php if ($entry->main_image) { $news_image = $entry->main_image->size(240,180); ?> <img src="<?php echo $news_image->url; ?>" width="<?php echo $news_image->width; ?>" height="<?php echo $news_image->height; ?>" alt="<?php echo $entry->title; ?>" class="small_frame" /> <?php } ?> <div class="clear"></div><!-- /.clear --> </div><!-- /.news_box --> <?php } ?> <?php // PAGINATION LINKS $pagination = $news->renderPager(); echo $pagination; ?> I've just re-read part of the pagination docs here and have added "start=0, limit=n" to my news_index template so now categories are showing even on 2nd page. Still can't seem to get pagination showing on categories template though
  16. Hi, I am including pagination on my blog page, its not quite working. I have 5 test posts in total, showing the first 3 posts on the main blog page. You can navigate to page 2 for the remaining 2 posts which works ok, but i'm losing my 'info' and 'about' pages in the main navigation which are children of the home page. Also the pagination links are showing 6 pages, which are empty after page 2. (too many pagination links) Here is the link to the blog page with pagination links at the bottom: http://www.hoof.net.au/pwire/blog/ This is the pagination code in on my blog page template: <?php $results = $pages->find("id>1, limit=10, sort=date"); $pagination = $results->renderPager(); echo $pagination; ?> I tried a few things after reading the pagination info page which mostly resulted in no pagination links at all. regards, Alex
×
×
  • Create New...