• Content count

  • Joined

  • Last visited

  • Days Won


Wanze last won the day on August 14 2015

Wanze had the most liked content!

Community Reputation

1,383 Excellent

1 Follower

About Wanze

  • Rank
    Hero Member
  • Birthday 06/19/1986

Profile Information

  • Gender
  • Location
    Bern, Switzerland

Recent Profile Visitors

11,920 profile views
  1. 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
  2. @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') }}.
  3. 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
  4. @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.
  5. 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
  6. 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
  7. @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
  8. 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
  9. @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
  10. @Macrura Muchas gracias for your additions! Could you open a pull request against the "dev" branch? I would like to integrate your features Cheers
  11. @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.
  12. What PHP version are you using? These kind of errors make me guess that mpdf is not compatible with your PHP version. Can you try to use the dev branch of the module via GitHub?
  13. I meant the active smarty template when you pass data in your controllers, e.g. $view->set('title', $page->title); The convention of the module is that the smarty template has the same name as the controller, e.g. home.tpl for your home.php file.
  14. No The global template file has nothing to do with smarty, it is a feature provided by the module that is available for all connected template engines. The global template file only means that you always get the same (smarty|twig|...)-template behind the $view API variable. As already said, you probably don't want to use a global template file with smarty, because you can use smartys template inheritance which is much more powerful. For me, this is the main reason to use a template engine.
  15. @Manaus Can you provide some example code? Unfortunately I do not understand what you mean by "no block is being passed". Is it possible you are mixing up features of the template engine with the module? In smarty, you use the {block} tags to define sections that are either inherited or overwritten in a child template. To overwrite a block, you must use {extends} in your child template. If you provide some code I'm sure I can help you Cheers