Jump to content

christophengelmayer

Members
  • 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.

  2. 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.

  3. 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.

  4. 28 minutes ago, matjazp said:

    Thanks for the module!

    After installing it, I get this warning when editing a page:

    
    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.

×
×
  • Create New...