Jump to content

[SOLVED] Calling render() after setPageNum() generates same output


christophengelmayer
 Share

Recommended Posts

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...