Jump to content

flydev

Members
  • Posts

    1,364
  • Joined

  • Last visited

  • Days Won

    49

Everything posted by flydev

  1. Ok sorry, so lets get started with a step-by-step coding moment. I based the work on your form I found there : http://pingu.eb-zuerich.ch/kurs/bildungsgang28/beglinger/cms/#shop What we are going to do : installing a module in order to get working with Google ReCaptcha Setting a variable which contain the site owner's address email. What the code do : check that GoogleRecaptcha is correct check the client's submitted data for security reasons show the form on the page show a message to the client only if captcha and submitted data are correct send email to the site owner and send email to the client's email You can copy the code, it should work fine. But I advice you to try to read it understand so we will go with more PW API next time Anyway, the following code is taken from here (a topic that is worth to read) and modified for your needs, more infos on the end of the post. 1) Install the module MarkupGoogleRecaptcha and configure it : Now the code : <?php $emailTo = ''; // address mail of the site owner (you can get this value from a field!) $emailBackMessage = 'Thanks you for your purshase.'; $captchamod = $modules->get("MarkupGoogleRecaptcha"); // get the module for GoogleReCapatcha $captcha_form = $captchamod->render(); // render Google ReCaptcha for including it in our form $sent = false; // check for error $error = ''; // error message $out = ''; // this variable will contain our HTML markup // sanitize form values or create empty $form = array( 'product' => $sanitizer->text($input->post->product), 'fullname' => $sanitizer->text($input->post->fullname), 'address' => $sanitizer->text($input->post->address), 'email' => $sanitizer->email($input->post->email), 'telephone' => $sanitizer->text($input->post->telephone) ); // check if the form was submitted and if ReCaptcha was check if($input->post->submit && isset($_POST['g-recaptcha-response'])) { if (!$captchamod->verifyResponse()) { $error = "<p class='error'>Please check the Google ReCapctha.</p>"; } // determine if any fields were ommitted or didn't validate foreach($form as $key => $value) { if(empty($value)) $error = "<p class='error'>Please check that you have completed all fields.</p>"; } // if no errors, email the form results if(!$error) { $message = "Full name: {$form['fullname']}\n" . "Email: {$form['email']}\n" . "Address: {$form['address']}\n" . "Tel: {$form['telephone']}\n" . "Product: {$form['product']}"; // send mail to the site owner mail($emailTo, "Contact Form", $message, "From: {$form['email']}"); // send mail to the client mail($form['email'], "Contact Form", $emailBackMessage, "From: {$emailTo}"); // populate body with success message, or pull it from another PW field $out = "<div class='alert alert-success'>Thank you, your message and your item has been recorded. An email confirmation as been sent to your inbox.</div>"; $sent = true; } } if(!$sent): // if the message was not sent successfully // the form markup $out = <<<HTML <div class="alert alert-warning">{$error}</div> <form role="form" id="frmContact" method="post" action="./"> <div class="form-group"> <label for="product">Article:</label> <select class="form-control" name="product" id="product"> <option>T-Shirt: white, slim</option> <option>Jacket: leather, black</option> <option>T-Shirt: grey, logo-print (reserved)</option> <option>T-Shirt: green, bus-print</option> </select> </div> <div class="form-group"> <label for="fullname">Name:</label> <input type="text" class="form-control" name="fullname" id="fullname" required> </div> <div class="form-group"> <label for="address">Address:</label> <input type="text" class="form-control" name="address" id="address" required> </div> <div class="form-group"> <label for="email">Email:</label> <input type="email" class="form-control" name="email" id="email" required> </div> <div class="form-group"> <label for="telephone">Telephone:</label> <input type="tel" class="form-control" name="telephone" id="telephone" required> </div> {$captcha_form} <button type="submit" class="btn btn-warning" name="submit" id="submitBtn" value="submit">Buy</button> </form> HTML; endif; // end if | email not !sent echo $out; // echo the markup ?> The code is well commented and self explanatory. 2) Set the email of the site owner. In the code : $emailTo = ''; // address mail of the site owner (you can get this value from a field!) Now you should be able to copy-pasta the code in place of the form in your page
  2. Yes. You should use WireMail. First option, you want to use AJAX to change your HTML markup dynamically. For example, if a client click on the button 'Buy', it will replace the form markup by a custom message like 'Thanks for your order!' WITHOUT reloading the page. For that, you need a PHP script which handle the mail process (you can found example here on the forum), bootstrapping ProcessWire and a simple Javascript script. Second option, you set your form action attribute to the same page - <form action="./"> ... </form> - and you process the $_POST variable (or $input->post) in the same page with PHP. This will reload the page, but do not redirect you to another page.
  3. You could simply add the size of the article (I mean, a t-shirt (the article) and XL (the size)) in the title of the select/option by concatenating your fields (article_title and article_size) and include in the email the value of the <select>/<option> element , so your client can see in his email a line with the correct item bought. I dont see in your code the select/option HTML element which is appearing on the website.
  4. @benbyf I forked the module and added the functionality, you can find the module at github: https://github.com/flydev-fr/MarkupTwitterFeed To search hashtag use it as the following : $options = array( 'searchQuery' => 'ProcessWire', 'limit' => 3 ); $t = $modules->get('MarkupTwitterFeed'); $out = $t->search($options); echo $out; The function search() act like render(). Thanks again for the suggestion (searching for hashtag). I think we can improve it a bit, let me know for any needs.
  5. I am used to deploy Vesta on the latest stable Debian (currently Jessie). No issue detected on my side during the installation and setup, everything is coherent. Configuration of new virtual host is setup in one click, same for user access and database. The only drawback is about the DNS, some knowledges is required to get working with (as always and each CP), but not required at all to run websites. Really, using it once is like adopting it.
  6. I am using it, VestaCP is very easy to setup and use. If you want an access on my test server let me know, as I dont remember if they have a demo online.
  7. To export pages as CSV file this module could be useful to you: BatchChildEditor
  8. [...] <td class="item"><a href=""><img class="article-image<?php echo ($article->article_reserved == 1) ? ' reserved' : ''; // 1 = checked, 0 = unchecked ?>" src="<?php echo $article->article_image->url; ?>"></a></td> [...]
  9. What say the doc : also $this is not callable in this context as you're not in an object. In order to get the hook working, you should write the hook in _init.php : function example1(HookEvent $event) { $page = $event->arguments[0]; wire('session')->message("Hello World 2 ! You saved {$page->path}"); } $pages->addHookAfter('Pages::save', null, 'example1'); And in admin.php, add : include("./_init.php"); Now go to in backend, and save a page, the message 'Hello World 2 ! You saved /your/page/' should appear.
  10. If you really want to build an array with index as Integer, you could do something like that : $array = new WireArray(); foreach ($data->img_gallery as $imageobj) { $array->add($imageobj); } then : foreach ($array as $key => $image) { echo = $key .' => '. $image->url .'<br>'; } Your object now look like this (exemple with 4 pictures in the image fieldtype) : ProcessWire\WireArray data protected => array (4) 0 => ProcessWire\Pageimage 1 => ProcessWire\Pageimage 2 => ProcessWire\Pageimage 3 => ProcessWire\Pageimage I let others answer, it will surely be better.
  11. Yep I did a test on the défault theme too, i didnt noticed something wrong, weird
  12. Welcome Dakrtom ! We would be glad to help you, but I am sorry that (I personnaly) cant understand your posts !
  13. I just tested on a fresh 3.0.32 install with Reno theme, I dont have any issue
  14. I created a simple image field (wihtout repeater). If you want a real example on howto use a repeater to make a carousel, tell me your repeater's structure and I will give you a working code but looking at your HTML markup, an Image field only like I did should be sufficient to achieve it.
  15. Hi, I made a ProcessWire profile powered by Bootstrap 4 with a bootstrap carousel. You can look at the code there : https://github.com/flydev-fr/site-pwbs4/blob/master/templates/_func.php#L213-L250 and adapt it for your need. It should be really easy. Which version of Bootstrap you are using ? (it look like you are on version 3.. confirm ?)
  16. You could read this blogpost, meanwhile others developers answer: https://processwire.com/blog/posts/processwire-3.0.14-updates-file-compiler-fields-and-more/#file-compiler-updates
  17. The same behavior described by @Klenkes happen to isotope too and for sure this is your issue. As exemple, isotope in his version 3 is not bundled with imagesLoaded; so we have to link imagesLoaded and initialize it as parent of isotope elements. eg: var $parent = $('#grid-parent'); var $grid = $('#grid'); $parent.imagesLoaded( function() { $grid.isotope(); });
  18. @hellomoto on dev branch you need to add the namespace. On top of your file, write: <?php namespace ProcessWire; [...] and you will call DirectoryIterator like this : $it = new \DirectoryIterator(...);
  19. @jploch before calling the function, call the module : <?php $map = $modules->get('MarkupLeafletMap'); echo $map->getLeafletMapHeaderLines(); ?>
  20. Thanks @LostKobrakai , sometime I feel dumb
  21. Hello guys on a ProcessWire-3.0.30, I can't get to work the InputfieldDatetime / date-picker, someone noticed it ? Is there a date-picker by default ? (it is the first time I use this fieldtype)
  22. I just integrated this module in a ProcessWire 3.0.30 project and it works.
×
×
  • Create New...