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 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
    • By LuisM
      Hi there,
      im a bit lost right now. I added an hook after templates::save which should get the affected template and write its template ID into a JSON.
      The problem is, the event->object gives me an instance of the templates class. How can I narrow this down to the saved Template and get its ID and fieldgroup?
    • By Clément Lambelet
      Hey!
      I've been working on a Processwire installation (3.0.123) for a few days now and I must have made a big mistake this morning because the links in the admin's main menu no longer appear.
      This is not related to the admin theme, because the bug occurs with all themes (Default, Reno, Uikit).
      I tried to reinstall with the dev version (3.0.136), but the problem is still there. I also uninstalled all the modules I had added, without success. There is no error in the js console. 
      I still can access/view/edit the pages  by going through the admin/page list.
      Thanks in advance for your help!


    • By MateThemes
      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!
×
×
  • Create New...