-
Posts
127 -
Joined
-
Last visited
Everything posted by Harmen
-
Just discovered this topic, and it's great! Bit late, but hey better later than never Below some of the music I listen to while coding besides Epic music: https://www.youtube.com/watch?v=z4nKOzk8qbw&index=64&list=WL https://www.youtube.com/watch?v=1GkYZH7AoS4&index=53&list=WL If the music has a decent beat, the singer a nice voice then I'm in!
-
Glad it works now! Good luck with the further development of your website!
-
Sure! See the snippet below if ($input->post->submit) { // === When submit button is clicked if ($v->validate()) { // === Validate the data if ($captcha->verifyResponse() === true) { // === Verify Captcha $subject = 'Contact Form'; // === Subject $messageHTML = include_once('partials/contact/_email.php'); // === Get the message, is in HTML $mail = wireMail() // === Set up the mail data ->to($contactFormRecipient) ->header('Reply-To', $email) ->subject($subject) ->bodyHTML($messageHTML); if ($mail->send()) { // === If mail is sent, while sending e-mail $session->flashMessage = __('Thank you for your message! We will get back to you.'); $session->sent = true; $session->redirect($page->url); } else { // === If mail isn't sent $session->flashMessage = __('Mail not sent. Error occured.'); } } else { // === Captcha error $session->flashMessage = __('Recaptcha Validation Error'); } } else { // === Validation errors $session->flashMessage = __('Please correct the errors and try again.'); } }
-
Hi, I think if you replace this: $m->to($contactFormRecipient) ->from($email) ->subject('Contact form submission') ->bodyHTML($message) ->send(); with the following: $m->to($contactFormRecipient) ->from($email) ->subject('Contact form submission') ->bodyHTML($message); that it will work and the email will be send one time, that's how my contact form works , I hope this helps you ~ Harmen
-
One thing to make your foreach loop a bit smaller and faster is to move these lines of code (below). Just set them before the foreach loop. As far as I can see you are checking the date for each ad, but it's always the same so it's faster to define it once. $todaysdate = date("F j, Y H:i"); $today = strtotime($todaysdate); So that results in this: $ads = $pages->find("parent.template=client, sort=expiration_date"); // === Get $ads $alert_count = 0; // === Set alert count $todaysdate = date("F j, Y H:i"); // === Get the date $today = strtotime($todaysdate); // === Make a string from the date foreach ($ads as $ad) { // === Start foreach $expireson = $ad->expiration_date; $expires = strtotime($expireson); // === I think you can also shorten this to $expires = strtotime($ad->expiration_date); Maybe you can even try $fiveaway = strtotime($ad->expiration_date) - 432000; $fiveaway = $expires - 432000; if ($today > $expires) { $alert_count += 1; } } // === End Foreach echo $alert_count; // === Echo the counter result Hope this helps...
-
@fbg13, you're a real hero! EDIT: Uh, I meant also @flydev, your code did the trick. Now it looks like it should look! Thanks! I think the space between the ' ' did the trick, I am not sure but I will spend this evening to figure out what I did wrong. I am building this module to make the process for handling RMA's in my company easier. So I am creating a module and $this->GeneralfieldsSelector grabs all the fields that are selected in the module settings to show them on the frontend. I didn't want to build the form itself because maybe I will also release this module here on PW and than is this a bit better than a custom made HTML-form XD
-
Yep, these are modules like Batch Child Editor, Tracy Debugger, ReCaptcha and some custom made modules. But I don't think any of these modules conflict with the module I am working on now.
-
@fbg13: // === The render method that links to the render form method public function ___render(){ return $this->renderForm(); } // === The renderForm() method protected function renderForm() { $form = $this->BuildForm(); $form->setMarkup(self::$markup); // === Pressed submit? if ($this->input->post->submit){ $form->processInput($this->input->post); if (!$form->getErrors()){ if ($this->sendEmail == true){ $text = 'Configure Email options' //to do } } } return isset($text) ? $text : $form->render(); } // === Build Form Method protected function BuildForm(){ $form = $this->modules->get('InputfieldForm'); $form->method = 'post'; $form->attr('id+name', 'rma-form'); // === Add the fields to the form if (is_array($this->GeneralfieldsSelector)) { foreach($this->GeneralfieldsSelector as $fieldName){ if ($field = $this->fields->get($fieldName)){ $input = $field->getInputfield($this->page); $input->attr('class', 'form-control'); $input->skipLabel = true; $form->append($input); } } } // === Submit button $submit = $this->modules->get('InputfieldSubmit'); $submit->name = 'submit'; $submit->attr('class', 'btn btn_default'); $submit->attr('value', 'Send RMA request'); $form->append($submit); return $form; } I don't think the problem is in this piece of code, but maybe I've done something wrong...... // ====== @OLSA: I've tried that mate, but it doesn't work... Thanks for your comment though!
-
No problem! Unfortunately, this works neither
-
Yep, the text is gone now, and the icon too....
-
Mulitlingual site : titles in foreign language do not appear
Harmen replied to helmut2509's topic in General Support
Glad you fixed it. Good luck with the development of your website -
Mulitlingual site : titles in foreign language do not appear
Harmen replied to helmut2509's topic in General Support
Hi, If you go to a page that doesn't show up, and you go to the settings of that page, is the checkbox checked to activate the english URL? See image below, the checkbox should be checked -
That's an option, but I think it's better to fix this issue in the markup itself.
-
Hi all, I am trying to build a form in a module. So when the render() method is called, I build the form and I want to apply a custom markup, which is defined in an array. Unfortunately I can't remove some text in my label. Instead of a label I want an icon, but there is always some text next to my icon as you can see below: I don't know how, but my icon is placed in the label, and that's not what I want. My markup looks like this: static protected $markup = array( 'list' => "{out}\n", 'item' => "\n\t<div class='form-group input-group'>\n{out}\n\t</div>", 'item_label' => "<label class=input-group-addon>{out}</label>", 'item_icon' => "<span><i class='fa fa-fw fa-{name}' aria-hidden='true'></i></span>", 'item_content' => "{out}", 'item_error' => "\n<p class='field--error--message'>{out}</p>", 'item_description' => "\n<p class='field__description'>{out}</p>", //.... etc ); and results in this: <div class="form-group input-group"> <label class="input-group-addon"> <span> <i class="fa fa-fw fa-envelope" aria-hidden="true"></i> </span> E-Mail </label> <input id="Inputfield_contact_email" name="contact_email" class="form-control InputfieldMaxWidth" type="email" maxlength="512"> </div> and what I want is: <div class="form-group input-group "> <span id="contact_form" class="input-group-addon"><i class="fa fa-user" aria-hidden="true"></i></span> <input required="" class="form-control" name="name" id="contact_form" type="text" value="" placeholder="Name"> </div> The only problem is that the code above is hard-coded and I don't know how to remove that piece of text next to my icon.... Thanks in advance, ~Harmen
-
@Robin S, thanks for the links. I fixed or cheated it in a bit different way. In the success function of the AJAX Post, I check for the reply if it is success or not. If it is equal to success I redirect to the same page with a query behind the normal URL. In the file I check if the query is in the URL and if so I push the file as a download. The only thing insecure to this method is that if you know the query you can still get the file without a serialnumber. Anyway, it works for the time being, hopefully this helps someone else
-
Hi folks, On the website I am working on I do have a form which needs to be filled in (duh) and when the user clicks on download, the data is send with ajax and processed in the same file by using the ProcessWire API with $config->ajax; The data which is provided by the user will be checked with data in my database. If the data is correct I want to push a file download. But this is not working at the moment. It seems like the content of the (.exe) file is pasted in the console instead of pushing the file. My code looks like this: if ($config->ajax){ $serial = $input->post('serial'); $DB = DB(); $query = $DB->prepare("/*My query here*/"); $query->bindParam("comparision", $serial, PDO::PARAM_STR); $query->execute(); $reply = ''; $SN_rows = $query->rowCount(); if (!$SN_rows > 0) { $reply = 'error'; } else { $reply = 'success'; $installer = $page->attachments->eq(1); $filename = "Filename"; $filepath = $installer->filename; $options = array( 'forceDownload' => true, 'exit' => true, 'downloadFilename' => $filename ); wireSendFile($filepath, $options); } echo $reply; exit(); } What am I doing wrong here or is it a bug? Is there another way to do this with the processwire API? Thanks in advance, ~Harmen
-
Hi all, I do have a form in the 'backend' of my website which has a fieldtype of ASMSelect. I gave all the options of that field a custom attribute with a value: foreach ($feature_group['features'] as $feature_id => $feature) { $field->addOption($feature_id, $feature['name'], array('data-feature_group' => $feature_group_id)); } How can I read out the value of that custom attribute named data-feature group? I've tried it with $selected_feature_groups = $form->get($category_id)->getAttribute('data-feature_group'); //AND selected_feature_groups = $form->get($category_id)->feature_group; but that doesn't work. How can I get this to work? ~Harmen
-
[SOLVED] CKEditor - extra plugin does not show up on admin
Harmen replied to zota's topic in General Support
Shame to me, didn't notice that. -
[SOLVED] CKEditor - extra plugin does not show up on admin
Harmen replied to zota's topic in General Support
Have you tried to put only the plugin file there and not in a directory? I mean, PW says to put the plugin file directly in the plugin folder so that should work I guess -
Hi all, Currently I am working on a filter for all the products in a category. So I've set up a class and built a (PW) form in it. When the user clicks on continue the form should return a processform function which sets the variable of the form in a session. Later in the file I want to read out that session and use that variable to select which products should show up and which should be hidden. So now with code examples to make it a bit more clear for you: In my file I start with a class: class classname { public function ShowForm() { $form = $this->Form1(); if ($this->input->post->submit) { if ($this->processForm1($form)) $this->session->redirect("./"); } return $form->render(); } Then a form inside the class: protected function Form1() { $form = wire('modules')->get("InputfieldForm"); $form->description = "Fill in the fields to find the mouse which fits your wishes"; $form->label = "Mouse Selector"; $form->action = "./"; $form->method = 'post'; $f = wire('modules')->get("InputfieldRadios"); $f->name = "Hand"; $f->label = "label"; $f->addOption(1, "1"); $f->addOption(2, "2"); $form->add($f); $this->addSubmit($form, 'Continue'); return $form; } This function is called when the user submits: protected function ProcessForm1($form) { $form->processInput($this->input->post); $this->session->hand = (int)$form->get("Hand")->value; } As you see I store the variable of the submitted form in a session. After closing the class I continue with building the page and then I want to read out that variable: $value = $this->session->hand; $content .= "Value of 'Hand': " . $value; But when I execute this on my website I cannot see the value of the form. Have I done something wrong or how can I fix this? Thanks in advance, ~Harmen
-
ProcessWire database installation / softaculous
Harmen replied to fredbob's topic in General Support
Do you mean the core modules or the modules at /site/modules? And is that really a problem to refresh once to initialise the modules? -
module JqueryIonRangeSlider (pre-release)
Harmen replied to Macrura's topic in Module/Plugin Development
Looks great! Looking forward to implement this! -
I think this can be done with a simple if statement.... Don't have the time to provide a snippet for you at the moment, I'm sorry. Something like this: if ($image->caption){ //Output markup 1 } else { //Output markup 2 }
-
Hi Manlio, Are you sure you've set a name in different languages? So if your page is called 'Prodotti' in Italiano, is it 'Products' in English? ~Harmen