Jump to content

Wanze

PW-Moderators
  • Posts

    1,116
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Wanze

  1. The page you try to download the PDF from (the given ID via get parameter) must: Be viewable for the current user Its template must be allowed to create PDFs (see the module config) Otherwise you should debug around this line: https://github.com/wanze/Pages2Pdf/blob/master/Pages2Pdf.module#L91 Cheers
  2. @gmclelland I would suggest to create a new module which uses the TemplateEngineTwig::initTwig hook. Having your own module also allows to enter/store some config data to map the namespaces to a path etc. Cheers
  3. @onjegolders What do you mean with layout file, can you give an example of your setup? Do you have a corresponding controller file (aka ProcessWire template in /site/templates) for the template of the current $page? Cheers
  4. Hey guys, I'm sorry for currently not finding the time to maintain the module. I think it should still work with ProcessWire 3, at least I'm using it on one site running on PW 3. @PWaddict If you find time, could you send a pull request for the icon? Thanks
  5. @Robin S Thanks for your work! I will gladly merge a pull request to make this module PW3 compatible
  6. This function is no longer global but in the ProcessWire namespace in PW 3.x Maybe it's a namespace issue?
  7. @Peejay Of course, it doesn't matter where you place the folder as long as the user running apache has write permission. So for testing purposes, you could also place the folder inside the document root. Cheers
  8. @k07n Thanks for the examples, i just pushed a commit to the master branch implementing this (version 1.0.2). Cheers
  9. @k07n I tried to use realpath but it is failing to resolve my relative paths. How would you expect this to work, would you enter relative paths from the ProcessWire root or the document root? Could you give an example? Thanks. Cheers
  10. It seems like you need to handle the "online" mode on your home.php template. You only update the content after submitting the form, if you directly visit the homepage, you will still see the login form even though you have a valid session. So you need to differentiate two cases in home.php: Not logged in: Display Login form Already logged in: Display "online" mode, hiding login etc. Basically the same as you're doing in javascript after successful login Cheers
  11. I mostly try to use FormBuilder which does all the work However, if I need special forms in terms of styling or functionality, I'm using the ProcessWire form API to render and validate/process the input. You also get free CSRF protection. Here's an example how roughly works (written in browser, not copy paste ready): // Controller contact.php // ------------------------ $form = $modules->get('InputfieldForm'); $select = $modules->get('InputfieldSelect'); $select->required = 1; $select->setOptions(['blub', 'blub2']); $form->append($select); $csrf = $session->CSRF->renderInput(); $view->set('inputs', ['select' => $select', 'csrf' => $csrf]); // Validate and process the input if submitted if ($isSubmitted) { $form->processInput($input->post); // Handle errors and success } // View contact.twig // ------------------------------ <form action="{{ page.url}} " method="POST"> <label>Select</label> {{ form.select.render() }} {{ csrf }} <button type="submit">Submit me</button> </form> Cheers
  12. You can use yourmodule.module.php Cheers
  13. There are several problems in your code: wire('input')->post always returns true, so you can't use this check. wire('input')->post->submit only returns true, if your POST data contains an element having "submit" as name, I can't see this in your form. So you could add a hidden element like this: <input type="hidden" value="1" name="submit"> Also your hidden element containing the page title as value is missing a name attribute Hope it helps! Cheers
  14. Maybe you can set the headerMargin setting to zero in the WirePDF module configuration? Do you print the header?
  15. @thomas Can you show the code how you output the images in the PDF template? It should work fine to use $image->url. Do you use pagefileSecure by any chance? Cheers
  16. What rendering issues do you mean? The problem is that you cannot measure performance in printing out objects. If objects contain a lot of references to other objects, this may take time to print out. In terms of page types, you have references to other pages and there may be a recursion problem, e.g. print a parent page with references to its children pages, each child page has again a reference to the parent) etc. The Page field is one main features in ProcessWire, at least for me. It makes the whole system powerful in terms of data modeling. If you want to measure performance, you should do it right, for example with a PHP profiler. Btw I'm also fan of clean code and good performance, that's why I'm working with ProcessWire Cheers
  17. @k07n Makes sense, I will update this and release a new version tomorrow. Cheers
  18. @suntrop That decision is up to you of course. Since the module is released open source, you are free to change the code according to your needs - should you need any starting point ;-)
  19. $session->count = $session->count + 1
  20. Could you explain the reason? I'm interested because I know smarty from earlier and didn't use twig so far, my impression is that they are both similar in most areas. Good thing about using the template engine factory is that you can now replace your smarty templates with twig templates, without touching any code in the controllers
  21. If you enable the pagefileSecure, requets to serve files from /site/assets/files are not delivered directly by the webserver but routed through ProcessWire, which does the permission checks. So it slows down the delivery of the files, because they are served by PHP. If you only need to secure specific files, you could also try the SecureFile module: http://modules.processwire.com/modules/fieldtype-secure-file/ It is an extension of a regular file field with the possibility to customize the storage location - here you would typically choose a folder outside the web root. Cheers
  22. @gmclelland Which version of ProcessWire are you using? I checked the Config class, more detailed this line: https://github.com/processwire/processwire/blob/master/wire/core/Config.php#L186 What happens if you do: {{ config.urls('root') }} ? ProcessWire often makes use of PHP's magic methods, I remember to read somewhere that Twig may have a problem with this because the dot is used to access both properties and methods of an object.
  23. $session->count++; You cannot increment the count variable like this, as it is accessed via PHP's magic setter. Try this: $count = $session->count + 1; $session->count = $count;
  24. @gmclelland Regarding the error when using tracy in twig: I think that the function "bd" is not available in twig. You can't use any global functions from PHP, they are wrapped by registered functions in the twig environment. After all, twig should just be used to present stuff. Though @jmartsch mentioned that it works, so I'm not sure. I guess that you would need to register a custom function to twig, via hook, which wraps around "bd". But I suggest to debug your application/variables on the PHP site instead of twig templates.
×
×
  • Create New...