christophengelmayer
-
Posts
11 -
Joined
-
Last visited
-
Days Won
1
Posts posted by christophengelmayer
-
-
- 1
-
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.
-
Just pushed version 0.0.5 to GitHub.
I changed the namespace to "ProcessWire".
@matjazp Thanks for the hint.
-
@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.
-
59 minutes ago, wbmnfktr said:
How nice does StaticWire play with ProCache?
If you use ProCache you don't need StaticWire (imho).
StaticWire is built for a different usecase.
59 minutes ago, wbmnfktr said:Will I export the ProCached-version of my pages - including compiled CSS and JS, minified HTML?
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.
- 1
-
20 minutes ago, d'Hinnisdaël said:
Very nice! Love the idea. I'd like to try this out, but I think this will only make sense for production environments if the static copy is completely self-contained, i.e. including paginated pages, assets, etc. You could probably easily do that using wget and some command line magic. Your module would then make the whole process configurable and user-friendly, e.g. to run it via cron, via hook after page save, etc.
Example gist: Download an entire website with wget, along with assets
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.
-
28 minutes ago, matjazp said:
Thanks for the module!
After installing it, I get this warning when editing a page:
1× PHP Warning: class_parents(): Class ProcessWire\StaticWire does not exist and could not be loaded in C:\inetpub\wwwroot\wire\core\Functions.php:955
The odd thing is that it happens only on one template and I can't figure it out what could be wrong with that particular template...It happens when editing the page, not exporting?
Can you post the template code, looks like some Namespace issue.
-
-
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.- 17
StaticWire - Covert pages to static HTML
in Modules/Plugins
Posted
@pmichaelis
I just released version 0.0.6 which fixes the "Class not found" issue.
https://github.com/christophengelmayer/StaticWire