Jump to content

Juergen

Members
  • Posts

    1,228
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Juergen

  1. Ok, give me a minute, I will add an if condition. In the meantime you can take a look at the example of uploading a file to page. https://github.com/juergenweb/FrontendForms/blob/main/Examples/fileuploadtopage.php This is the way to go - I have tried it and it works in my case.
  2. Ok, in this case you should point the upload folder to be the folder with the id of your page inside the files directory // add this to your form object $form->setUploadPath($page->id, true); I have not tested it, but it should create a folder with the id of your page under the site/assets/ directory and store the file, that you have uploaded inside.
  3. This may be interesting for you too, if you want to upload the files to a specific directory: https://github.com/juergenweb/FrontendForms#setuploadpath
  4. Do you want it to send it with emails, then you have to add the sendAttachments(); methods to the WireMail object as written at the bottom of the file, or do you only want to upload it to the files directory?
  5. Hi @pmichaelis, it is indeed a little bit hidden, but you will find an example of a single and a multiple file upload field inside the example of the contact form at https://github.com/juergenweb/FrontendForms/blob/main/Examples/contactform.php Best regards
  6. Hello @Stefanowitsch There was a wrong query string inside the method, which is responsible to find all frontend templates. I have corrected it on Github. You do not need to download and install the whole module. Please replace the file JkPublishPages.module from the module with the new one at Github and let me know, if it works now. I have bumped up the module version too, because this was a significant malfunction. BTW: you can set the child settings to no again and only to mention: the homepage is excluded from the templates.
  7. My explanation, was for the parent pages, not for adding the publishing fields to the template. To clearify: This blog post template will not be visible at the checkboxes list for the templates in your case? I will take a closer look on my local installation and give you a feed back after lunch. I guess there will be a problem in querying templates.
  8. Sorry, @Stefanowitsch This was a missunderstanding. In your case every template should be visible.
  9. Hello Stefanowitsch, you are right - this is exactly what it does. If you need a certain page to be selectable, you have to make some adjustments in the appropriate page template and sometimes in the template of the parent too. I recommend you to take a look at both template settings (current page template and parent page template) - in one or in both must be some restrictions set. If you need help, you can post a screenshots of both template settings here, and I will try to figure out the responsible setting. This would not help you, because, apart from this module, ProcessWire does not let you choose and store a parent page, which will be not be allowed to be a parent page according to your template settings.😉
  10. No, my email templates are made the old fashioned way (HTML tables) and hand-written. And there is no namespace used inside those email files. The template files are part of a module and the module has its own namespace (not Processwire). So the module can send out various emails. It works fine until multi-language is used. I dont think that there is a namespace problem. I also use some placeholders inside the templates, which will be filled with variable data from outside and this works in multi-language, because the translations are not set inside the template file, they are set inside the PHP file for sending the emails.
  11. Yes, you are right - PHP files will be fetched. Anyway, the strings are still in the default language. No difference to before! 😔 I guess I have to overthink my template system for sending HTML emails, because the template files are always HTML files. Thank you for your help @gebeer
  12. OK, it seems to be another problem that I thought it would be: The translateable strings were not found by PW. I have so much translations done, that I did not notice that the strings are not translated in the backend.😱 In other words: All translateable strings inside this template HTML file do not appear in the backend to be translateable, so they are not translated. Now I have to find out, why these files were not fetched by ProcessWire.
  13. This is a good idea @gebeer but unfortunately, I got the same result as using ob_get_contents. The translateable strings are not translated.😬 If I check the user language with Tracy bd() function, I always get that the user language is set to German. This is the correct language, but the strings are still in English.
  14. Hello @ all I am struggeling with this problem now for hours and I could not find a working solution.😔 Problem description: I have a HTML file, which is a HTML template for an email - so it includes Markup, static texts and translateable strings. Lets assume that it would look like this: mail-template.html <p>My mail template</p> <?php echo _('Hello user');?> On another file, which should send the mail, I want to include this file to be the mail->body. mail_sending.php ob_start(); include('path/to/my/mail-template.html'); $body = ob_get_contents(); ob_end_clean(); As you can see, the variable $body contains now my rendered HTML file - this works, but it does not take account of the user language. It always outputs the translateable strings in the default language. I have not found a way to output it fe in German. The goal: I want to put the rendered content of the mail-template.html (including the correct translations of the text!) to PHP variable, so I can use it as the mail->body text. $mail->bodyHTML($body); The problem is, that ob_get_contents does not take account of the user language, even if I set it explicitely. I have also tried it with file_get_contents, but in this case, I cannot get the rendered text. Does anyone have an idea, how this could be done??
  15. BTW: You will get also a notice that your system does not fulfill the requirements if you have not installed LazyCron (not only if the PHP version is lower). You can ignore this, because LazyCron will be installed automatically during the module installation, if it is not installed. Unfortunately, Processwire gives you a warning that your system does not fulfill the requirements for the module, but not exactly what the problem is. 😔
  16. No, it should work with 8.0, but not below. I have not checked it directly on my local server, but PHP-Storm does not complain after changing the version. I have changed the version on GitHub too, but you do not need to download it again. Please let me know, if something unexpected occurs, but I guess it will not.... BTW: In the module configuration settings set the CronJob interval to 1 minute for testing purposes, so you can check the functionality immediately. Later on, setting the value to 1 hour again, will be enough. Best regards
  17. Glad to hear that! 😀 Let me know, if you discover any issues. I will add this as soon as possible to the ProcessWire module directory, but as written, it needs to be tested first by several people.
  18. This is a reissue of a module of mine called "PublishingOptions", that I wrote a while ago. The big difference is that this module is written in PHP 8 and has some nice additional features. The old module could only publish and unpublish pages depending on date and time settings, but the new version goes much further. So you can decide what should happen after the publication end date has been reached. You have the following options: Unpublish the page - this is what the old version did Move the page to trash - new Delete the page permanently- new Move the page to a new position in the page tree - new The last option will be interesting if you want to move the page fe to an archive after a certain date. You can select the new parent page and after the publication end date has been reached, the page will be moved under the new parent page. You will find a more detailed instruction and download possibility at https://github.com/juergenweb/JkPublishPages This module is Alpha stage and should be tested carefully before using it on live sites. I have planned to add this module to the PW module download section, so everyone is invited to test it out and to report issues directly at GitHub. Thanx
  19. Thank you @wbmnfktr and @BitPoet for your suggestions. I have forgotten to write, that I have a working solution by using a foreach loop, but my goal was to get rid of the loop and to use a selector instead. I only wanted to simplify the code to increase the performance. This is the reason and therefore there is no possiblity to use a selector in this case, so I close this thread and use the loop 🙁
  20. Hello @ all Is there a possibility to filter a TemplatesArray by the selector childTemplates, which has an array as value? I have searched the net, but I have not found a solution. The problem seems to be that the value is an array and not a string. This does not work: $templates->find('childTemplates=[29,30]); This does not work too: $templates->find('childTemplates=29|30'); Has anyone an idea?
  21. Hello @bernhard First of all, thank you for your feedback. 🙂 To be honest, I did not even think about using a svg for a placeholder - but this is also a really cool idea too. BTW thanks for the link - I will take a closer look at this. Referring to your questions: My intention was to use it for real website users (as placeholder images for products, user images and so on). I did not want to use to much different font families on a site. For this reason I thought that it was cool to be able to use the same font for the text in the placeholder image as used for the text of the site. This is possible with this module. Another aspect was that a "real image" could be used without problems with CSS frameworks componentes, whenever an image is needed. I am thinking of the comment component of the UiKit framework. In the markup you will need an image tag for the user image. Of course you can replace the image tag by a div container with text inside or another tag (picture, image tag for svg,..), but you have to adapt the CSS of the framework to get the desired result. Using an usual image tag, as provided with this module, requires no changes. Have a nice weekend!😀 Jürgen
  22. Hello @ all I want to introduce a module to you which can create placeholder images on the fly. This module was developed a few years ago, but I have completely rewritten the code to PHP 8.1 and added some nice additional features. You can find the complete description and download possibility at https://github.com/juergenweb/JkImagePlaceholder, but I want to give you a brief description about the module. Since 28/01/23 this module is also available in the download section of ProcessWire at https://processwire.com/modules/jk-image-placeholder/ and can be downloaded within your ProcessWire site. Short description: This module uses TrueType fonts for the placeholder text. 2 TTFs are shipped with this module by default (FjallaOne-Regular.ttf and Lobster-Regular.ttf). Allows upload and deletion of other fonts Allows scanning the complete site to find and use other TrueTypeFonts (fe used by templates or other modules) Preview of all fonts in the select font input field - you can see how the font looks like Global setting of various colors: background color, text color,.. Supports adding of text shadow to the placeholder text Set global placeholder text (multi-language) Set global image tag CSS class for the placeholder image tag If you have installed FieldtypeColor or FieldtypeColorPicker you can select if you want to use one of these fields for color inputs instead of a text input. Preview example: The easiest way to create the placeholder image inside your template file: echo $modules->get('JkImagePlaceholder')->render(true); This will render the placeholder image according to your global settings in the module configuration, but you can change every parameter to your needs: echo $modules->get('JkImagePlaceholder') ->setText('Test!') ->setAltText('My custom alt text for the image') ->setFontSize(30) ->setWidth(400) ->setHeight(200) ->setBackgroundColor('#ddd') ->setFontFamily('lobster-regular.ttf') ->setTextColor('#ffffff') ->setShadowColor('#000') ->setXOffset(-5) ->setYOffset(1) ->render(true); Everything is explained in the Readme file on GitHub and in the download section. If you discover issues, please report it directly on GitHub🙂 - Thanx for your help!
  23. Hello @abmcr Why do you not extend the button drop down with your pdf feature instead of adding a new button. BTW: Adding a second save button was the way to go a at the time where PW did not offer the possibility for a drop down button. To get an additional dropdown level for PDF, please put the following piece of code inside your site/templates/init.php or site/templates/ready.php. If the files do not exist by default, you have to create them manually. $wire->addHookAfter('ProcessPageEdit::getSubmitActions', function($event) { $actions = $event->return; $actions[] = [ 'value' => 'value of action, i.e. view, edit, add, etc', 'icon' => 'file-pdf-o', 'label' => 'Pdf', 'class' => 'btn_pdf_plan', ]; $event->return = $actions; }); Only to mention: do not forget to change the value to your needs (fe save in your case). Best regards
  24. Hello @ all I am using a lot of hooking of methods and I want to optimize the performance of a module a little. In my case I use the following Hooks inside my modules init() method: public function init() { $this->addHookBefore('Page::render', $this, 'function1'); $this->addHookBefore('Page::render', $this, 'function2'); $this->addHookBefore('Page::render', $this, 'function3'); $this->addHookBefore('Page::render', $this, 'function4'); } As you can see, I am always hooking the same method (Page::render) to run different functions. The functions itself are declared outside of the init() method. My question: Would it have an impact on the performance if I would fe summarize function1 to function4 into one function (see below) or does it not matter? public function init() { $this->addHookBefore('Page::render', $this, 'summarizeFunction'); } protected function summarizeFunction() { $this->function1(); $this->function2(); $this->function3(); $this->function4(); } As you can see, I have only 1 hook left, that hooks into Page::render - not 4 as before. I have not try it, if there would be a significant performance boost or not. I only want to ask some other devs if they have experiences if this could be optimize the performance a little bit or not. Best regards
  25. Thanks @Jan Romero What a silly mistake!!! 😨😭You are right: Sure, that was the mistake. I know that it must be $event and not $field, but I have overlooked this silly mistake over and over and I was wondering why it did not work. I have tried it with $event->object and $event->arguments(0).... BTW: Now both Hooks work with $event->arguments(0)!! Thanks for your help!!! Thanks for helping me
×
×
  • Create New...