Wanze

PW-Moderators
  • Content Count

    1,038
  • Joined

  • Last visited

  • Days Won

    9

Wanze last won the day on August 14 2015

Wanze had the most liked content!

Community Reputation

1,394 Excellent

1 Follower

About Wanze

  • Rank
    Hero Member
  • Birthday 06/19/1986

Profile Information

  • Gender
    Male
  • Location
    Bern, Switzerland

Recent Profile Visitors

12,238 profile views
  1. Wanze

    @Sten In home.twig, the block engagement block is nested inside the home block. In engagement.twig, this is not the case. Does it work if you either move it out of the home block in your parent template; or recreate the nested block structure in engagement.twig.
  2. Wanze

    @Sten Your twig templates look fine, the problem is the global template file setting. Just leave that config empty. This is a "global setting" of the TemplateEngineFactory which is supported by all engines, but actually makes no sense in Twig and generally in engines supporting template inheritance. It was introduced by a feature request, but now I think it's more confusing than useful. Cheers
  3. Wanze

    Hi @Sipho MarkupRegions is currently only processed during Page::render(). TemplateEngineProcessWire uses TemplateFile::render() to return the markup, where MarkupRegions are not recognized/populated. Here are the relevant lines: https://github.com/processwire/processwire/blob/master/wire/modules/PageRender.module#L521-L526 It should be possible to integrate this logic into TemplateFile::render via hooks. Unfortunately I do not have much time for ProcessWire these days I'm happy to accept a pull request though Cheers
  4. Wanze

    That's correct. The output from Twig is cached as static file and if present, ProCache directly serves this via .htaccess.
  5. Wanze

    Hi @Sipho Sorry I missed your post. I don't know/use markup regions myself, so it's hard for me to help. Does your code work if you disable the TemplateEngineFactory module? If it works, then somehow markup regions are not respected when your ProcessWire templates are getting rendered by this module. I try to look into this at the end of this week. Cheers
  6. Wanze

    @gmclelland Twig sometimes has problems when you try to access a property via magic getter. I consistently use $page->get('my_field') to avoid this issue. So in your example, you could use {{ post.get('event_description') }}.
  7. Wanze

    Hi @davenorton Welcome to ProcessWire! It is a scope problem: The $pages variable is not known inside your function by PHP. Use the global wire() function to get any API variable. At the beginning of your function, write this: $pages = wire('pages'); And it should start to work. Cheers
  8. @gmclelland I noticed the same problem on a project of mine. I tried to fix this with the latest release of the TemplateEngineFactory module (1.1.2). If you throw a Wire404Exception() the module now should set the correct 404 page for twig. So the redirect should not be necessary now.
  9. Hi @ak1001 Thanks! 1. Do not delete /site/templates/home.php. This file now acts as a "controller" and you will pass variables to your twig templates via $view. 2. You don't need this file, the corresponding twig file would be in /site/templates/views/home.html. Note that this path and the file extension depend on your module configuration. 3. Yes, this is actually your twig template. The below code belongs to /site/templates/home.php <?php $view->set("myvar", "my test var"); Think of this file as layer between ProcessWire and your twig template. So instead of echo stuff there, pass it to the twig template which takes care of the rendering. Hope that helps! Cheers
  10. Wanze

    Hi @Menz Sorry for my late response, I was traveling a longer time while you were posting this. I would be interested if you could solve it using the module? There is another approach which let's you control the caching: 1. Do not create a corresponding smarty template so that the module does not attach the render hook. This means that the controller aka regular ProcessWire template will work just normal. Let's call this template filter_response.php. 2. The filter_response.php can still use the factory to create the markup via Smarty but at the same time control the caching via WireCache. Something like this (inside site/templates/filter_response.php) if ($cached = $cache->getFor('my_namespace', $page->id) { echo $cached; } else { $tpl = $factory->load('filetered_response_template'); $tpl->page = $page; $output = $tpl->render(); $output = filter_output($output); $cache->setFor('my_namespace', $page->id, $output); echo $output; } Cheers
  11. Wanze

    @jtborger You could try to hook before Pages2Pdf::___createPDF() and change the page orientation based on the pages template: wire()->addHookBefore('Pages2Pdf::createPDF', function($event) { $page = $event->arguments('page'); $pages2pdf = $event->object; if ($page->template->name === 'your template') { $pages2pdf->getPDF()->set('pageOrientation', 'L'); } }); I'm not sure if it works though and I did not test if the above code is correct. Maybe it helps you to get started Cheers
  12. Wanze

    A little information for the observers here: The feature to view a secret file beside the forced download is now available in version 1.0.3. Thanks @Macrura! I introduced an additional setting on field level to toggle the "View" possibility. Cheers
  13. Wanze

    @FrancisChung You could try to use the version of the module available on the "dev" branch, which uses a newer version of mPDF: https://github.com/wanze/Pages2Pdf/tree/dev I really should merge to master... could you report back if it works and if not, what kind of issues you are facing? Cheers
  14. Wanze

    @Macrura Muchas gracias for your additions! Could you open a pull request against the "dev" branch? I would like to integrate your features Cheers
  15. Wanze

    @maxf5 Can you check if the image is existing on your hard drive by looking at the file in /site/assets/files? Recently I had a problem in ProcessWire that my thumbnails were not getting generated correctly if I was using numbers like 100,200,300,400 for the dimensions. Strangely it worked by using other dimensions like 110, 390 etc.