-
Posts
1,083 -
Joined
-
Last visited
-
Days Won
7
Everything posted by Juergen
-
Hello @all I have a configurable module and for better overview i have created a lot of fieldsets where I have placed configuration fields inside. By default all fieldsets are closed. So if an error occurs in one field after saving the module, I get the error message at the top, but the fieldset which includes the field with the error keeps closed. This is not very userfriendly, because you will not know in which of the fieldsets is the field which causes the error (I know, where to look, but someon who does not know my module will not...) So it would be great if the fieldset with the error field inside will be opened, after the form processing. Is there an inbuilt way to achive this or has someone struggled with the same problem and has found a working solution and will be so kind to post it here? Thanks in advance
-
Hello @xweb The placeholder is an attribute and you can add every attribute with the setAttribute() method described here. $yourField->setAttribute('placeholder', 'Enter your first name'); // or with translatable strings $yourField->setAttribute('placeholder', _('Enter your first name')); Replace $yourField with the variable name of your field object and your done 😀! You can do this in the same way for every attribute (class, data-attribute, id, rel,.....). Have a nice day! Jürgen
-
Version 2.1.19 contains changes to make the module compatible with PHP 8.2 and following versions. All dynamically created properties have been removed and replaced by a declared property which hold all the properties inside an array. The reason for this is that dynamicalle created properties will be depreciated in 8.2 (leads to a warning) and the will be forbidden in upcoming PHP 9. So, this was a change affecting a huge amount of files. So please test it carefully and report any issues directly on GitHub. IMPORTANT! Due to a writing mistake, there are wrong values inside the database: These wrong values will not be overwritten during the update. It is recommended to uninstall and reinstall the module after the update to be sure that the correct values are stored inside the database. Otherwise it is most likely that you will get an error after a form submission. Just to mention: the error is in the fieldname of the custom messages: instead of the field name "input_alertErrorText" and "input_alertSuccessText" I have written "input_input_alertSuccessText" and "input_input_alertErrorText". This causes an error after form submission. Thanks a lot!
-
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.
-
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.
-
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.
-
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.😉
-
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.
-
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.
-
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.
-
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??
-
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. 😔
-
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
-
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
- 13 replies
-
- 11
-
-
-
How to filter templates by selector childTemplates [SOLVED]
Juergen replied to Juergen's topic in API & Templates
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 🙁 -
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?