Jump to content
Peter Troeger

[SOLVED - kind of] Pagintion Link redirects

Recommended Posts

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

Share this post


Link to post
Share on other sites

Just a few thoughts...

  • Are there enough children/pages?
  • The selector needs limit AND start if I remember correctly.
  • Home (id=1) needs correct url settings for each language (for example: blank, de, fr, ...)
  • Enable config->debug to see if there are warnings and take a look at the logs - just to make sure.

Just looked into Pagination in ProcessWire but didn't find anything special you could try in addition to that.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for your reply!

  • I have 32 child pages, and it generates the navigation correctly with multiple pages.
  • I added a start, but that didn't change it.
  • URL settings are set to blank for the default and pt for the second language. I tried changing the default to de, just in case but the problem still exists.
  • debug is already enabled. No errors are logged.

I only have menubuilder and the login/register plugin for sitewide modules installed. Could it have anything to do with PagePathHistory?

Share this post


Link to post
Share on other sites

Ok... those modules you mentioned shouldn't interfere here in any kind. Even PagePathHistory shouldn't kick in there but you can check if there is anything set in the settings tab.

Could you post the whole page could or more than just that snippet? Maybe there is something in it.

Share this post


Link to post
Share on other sites

I found out that, if I remove uikit from my site, the page is not redirected, but stays on ' .parent-page/page2/ '.
It doesn't show the content from page 2 though. It still shows page 1 content.

This is the complete template page.

<?php namespace ProcessWire; 

?>

<div id="body_text">

	<?php
	
		$children = $page->children('start=0, limit=2');
		
		foreach($children as $child) {
			$title = $child->title;
			$body = $child->body;
			$file = $child->file;
			$file_url = $file['url'];
			$image = $child->single_images;
			if ($file=='') $file='#'; 
			
			
			?>
			
			<section class="mitteilung">
			
			<?php
			
			echo '<h2><a href="'.$file_url.'">'.$child->title.'</a></h2>
			<p>'.$body.'</p></section>';
			
		}
	?> 
			
			
			<?php echo $children->renderPager(); ?>
</div>

In the init file I add the uikit file.

Share this post


Link to post
Share on other sites

When I keep the uikit file, but remove the usage of uikit (I've had two instances af ukBlogPosts(pages()->get('/aktuelles/')->children, 1) included in the page),
the redirect doesn't happen anymore either. The content still doesn't change 🙂

Share this post


Link to post
Share on other sites

ok, I also removed the start=0, and now it works. Now I only have to find out, why it doesn't work when I use ukBlogPosts(pages()->get('/aktuelles/')->children, 1 ) and $children->renderPager(); on the same page 🙂

Share this post


Link to post
Share on other sites

Ok... so start is not necessary. Good to know. My fault. 😄 

Where does this ukBlogPosts() come from? Are you using one of the included profiles (Regular or how it is called)?
If so... I'm out... never used it. 😂 

If you don't need it there, you can just go on from here.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Markus (Blue Tomato)
      I'am working on a migration script from the ImageExtra Module to the new Custom Image Fields feature in ProcessWire.
      I have some problems while setting a field value to the new custom image field. I have set up the custom field and it works correct in the admin panel but not via the API:
      $page->images->my_custom_image_field = "test"; $page->save(); Results into:
      Fatal error: Uncaught ProcessWire\WireException: Item 'my_custom_image_field' set to ProcessWire\Pageimages is not an allowed type in /var/www/html/wire/core/WireArray.php:458
       
       
    • By brdje
      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.
       
       
    • By Peter Troeger
      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
    • By Jens Martsch - dotnetic
      Hi guys I need an estimate for the following task:
      I developed a job candidate application in ProcessWire and need an extension to a Lister Pro Page.
      My customer wants to display a summary table of the filtered data like in the attached screenshot.
      When you filtered the view, that summary should show how many candidates have which status according to the actual filtered view.
      If you change the filter, the summary table has to be updated also.
      Who can accomplish this task and what would it cost?
      I first need an estimate to tell it to my customer. If he says the price is ok I will provide you with FTP Data to a dev server version of  that tool.
      Thank you in advance.

    • By Noel Boss
      Admin Theme Boss
      A light and clear theme based on Uikit 3
      Features
      Five unique color options Beautifully redesigned login screens Modern typography using Roboto Condensed Extended breadcrumb with edit links Extends AdminThemeUikit, so you can continue using all current and future AdminThemeUikit features Option to activate theme for all users Compatibility with AdminOnStreoids and other third party modules   Updated and Releases
      There is a shiny new release page where you can subscribe to updates for new releases of AdminThemeBoss.   Color Variants:
      ProcessWire Blue


       
      Dark Black


       
      Vibrant Blue

       
      Happy Pink

      Smooth Green *new with 0.6.1*

       
      Requirements
      Requires a current ProcessWire version with AdminThemeUikit installed and activated.
      Installation
      Make sure AdminThemeUikit is activated Go to “Modules > Site > Add New“ Paste the Module Class Name “AdminThemeBoss“ into the field “Add Module From Directory“ Click “Download And Install“ On the overview, click “Download And Install“ again… On the following screen, click “Install Now“

      Manual Installation
      Make sure the above requirements are met Download the theme files from GitHub or the ProcessWire Modules Repository. Copy all of the files for this module into /site/modules/AdminThemeBoss/ Go to “Modules > Refresh” in your admin Click “Install“ on the “AdminThemeBoss“ Module
×
×
  • Create New...