Jump to content
Peter Troeger

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.

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.

Γ—
Γ—
  • Create New...