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.
@matjazp I'm not familiar with fields of type "Module Reference". Which FieldType do they use?
Could you describe how to create a template that reproduce this issue.
Or can you share the site package for this project.
I'd like to look into this issue.
If you use ProCache you don't need StaticWire (imho).
StaticWire is built for a different usecase.
The Plugin (currently) does not export any assets.
It basically iterates over all pages, calls the render() function and stores the output in an index.html file in a folder that matches the pages URL.
You have to take care of the needed assets by yourself.
I just relased an update (0.0.5) which maybe fixes this issue.
The problem was, that the module also tried to export the admin pages. This is now prevented.
I tested it with the demo site packages (beginner, blank, classic, default, languages, regular) and it worked on all of them.
Thank you.
It definitely makes sense for a production environment where, for example, processwire runs on its own (hidden or whitelisted) domain.
I‘m also thinking about using it as a backup tool or just a local tool for editing content and exporting static sites.
I‘ve used wget to create static sites before but it always involves a lot of manual editing to correct urls and asset paths.
So I came up with the idea to use PW to directly render pages to html.
Currently I‘m thinking about a solution to also render paginated pages.
Hi everyone,
Introducing my first module
https://github.com/christophengelmayer/StaticWire
It's a simple way to convert your ProcessWire site to static HTML files via CLI or the admin interface.
Useful in CI/CD scripts or to use ProcessWire as a simple static site generator.