Jump to content

[solved] Is it possible to render a page with a page number?


Robin S
 Share

Recommended Posts

If I have a template "news_items" that has page numbers enabled and that lists child pages ("news_item") with a limit of 20 news items per page, is there a way I can use $page->render() to render the page with a page number other than 1? For example, what if I want to render page 2 showing news items 21-40? It seems like it ought to be possible to do this but I can't work out how.

And similarly, is it possible to render a page with a particular URL segment or a particular GET variable?

Link to comment
Share on other sites

Good ol' ProcessWire - there's always a way!

// Get the page to render
$p = $pages(1234);
// Set a page number
$input->setPageNum(2);
// Set a URL segment
$input->setUrlSegment(1, 'my-segment');
// Set a GET variable
$input->get->foo = 'bar';
// Render the page
echo $p->render();

 

  • Like 5
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...