-
Posts
1,082 -
Joined
-
Last visited
-
Days Won
7
Posts posted by Juergen
-
-
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!
-
1
-
-
Could you please download and replace the following file:
https://github.com/juergenweb/FrontendForms/blob/main/FrontendForms.module
Let me know, if the error is gone
-
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.
-
1
-
-
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.
-
This may be interesting for you too, if you want to upload the files to a specific directory: https://github.com/juergenweb/FrontendForms#setuploadpath
-
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?
-
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
-
1
-
-
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.
-
1
-
-
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.
-
1
-
-
Sorry, @Stefanowitsch
This was a missunderstanding. In your case every template should be visible.
-
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.
1 hour ago, Stefanowitsch said:Am I able to add the required fields "by hand" in the template settings instead?
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.
-
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
-
1
-
-
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. 😔
-
1
-
-
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
-
1
-
-
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.
-
1
-
-
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
-
10
-
1
-
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.
8 hours ago, BitPoet said:WireArray::filterData, which is responsible for executing the selector, does an explicit cast to (string) on the value.
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 🙁
-
1
-
-
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?
-
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
-
2
-
Is there a way to open fieldset inside module configuration if a an error occurs in one field inside this fieldset
in Modules/Plugins
Posted
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