Sergio

Members
  • Content count

    374
  • Joined

  • Last visited

  • Days Won

    8

Sergio last won the day on April 21

Sergio had the most liked content!

Community Reputation

502 Excellent

1 Follower

About Sergio

  • Rank
    Sr. Member
  • Birthday 04/13/1979

Profile Information

  • Gender
    Male
  • Location
    Belo Horizonte, Brazil

Recent Profile Visitors

5,591 profile views
  1. WOW!! This looks awesome, @joshuag!! Seems very useful, especially for speed up the creation of complex templates!!
  2. Sergio

    This is very impressive! Excellent job @bernhard!! Could you detail more about the PDF generation? Library used, how the custom design was made, how you control widows / orphans etc. Thank you!
  3. Sergio

    I use the same as you do on Mac and Win. Laravel Valet on Linux. And I only recommend moving to Docker if you need to work on a team AND need to replicate a server setup in all machines. And if so, I recommend trying Laravel Homestead.
  4. You may find great insights on this thread below, on how to do it by hand. A bit old, but probably everything works even today.
  5. Sergio

    You may need a hook to get it done, take a look on this thread:
  6. Sendy is great if your budget is small AND you need to send emails to a lot of people (10k+). Mailchimp is incredible, but the price for small business is not so good, especially when a dollar is almost 4 times your currency (Brazilian Real) Just keep an eye on your AWS SES reputation dashboard, for complain and bounce rates.
  7. Sergio

    I added the source code on this post:
  8. The module source is below. Example usage: a checkbox on a contact form (using Form Builder) for the user to subscribe. It's used on https://ricardo-vargas.com/contact/ EXAMPLE A method on _hooks.php. If you don't use Form Builder, use this code on your form page. $forms->addHookBefore('FormBuilderProcessor::emailForm', function($event) { $processor = $event->object; if ($processor->formName == 'contact-form') { $formData = $event->arguments(1); $contact_name = $event->sanitizer->text($formData['contact_name']); $contact_name = substr($contact_name, 0, 30); // limit length further $contact_name = $event->sanitizer->emailHeader($contact_name); $contact_email = $event->sanitizer->text($formData['contact_email']); $contact_email = $event->sanitizer->emailHeader($contact_email); $processor->emailFrom = $contact_email; //reply to $processor->emailSubject = 'Message from '.$contact_name; $form = $event->object->getInputfieldsForm(); $subscribe = $form->get('receive_updates'); $list_id = $form->get('sendy_list_id')->attr('value'); // check to see if they subscribed if ($subscribe->attr('checked')) { $success_url = '/contact'; // $fail_url = '/contact?error=1'; $ProcessSendyAPI = wire('modules')->getModule('ProcessSendyAPI'); $ProcessSendyAPI->subscribeInSendy($contact_name, $contact_email, $list_id, $success_url); } } }); MODULE https://gist.github.com/sjardim/2d834ebb0bd66d4da1ac16072f4075cd <?php namespace ProcessWire; class ProcessSendyAPI extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => __('Process Sendy API'), 'summary' => __('Handle API calls to a Sendy installation'), 'author' => 'Sérgio Jardim', 'version' => '001', 'singular' => true, 'autoload' => false, 'icon' => 'envelope' ); } /** * Data as used by the get/set functions * */ protected $data = array(); /** * Default configuration for module * */ static public function getDefaultData() { return array( "sendy_api_key" => '', "sendy_installation_url" => 'http://www.example.com/sendy' ); } /** * Populate the default config data * */ public function __construct() { foreach(self::getDefaultData() as $key => $value) { $this->$key = $value; } } public static function getModuleConfigInputfields(array $data) { $data = array_merge(self::getDefaultData(), $data); $wrapper = new InputfieldWrapper(); $f = wire('modules')->get('InputfieldText'); $f->attr('name', 'sendy_api_key'); $f->label = __('Sendy API Key', __FILE__); $f->description = __('Further instructions at https://sendy.co/api', __FILE__); $f->notes = __('Get your key at http://your_sendy_installation/settings.', __FILE__); $f->value = $data['sendy_api_key']; $wrapper->add($f); $f = wire('modules')->get('InputfieldURL'); $f->attr('name', 'sendy_installation_url'); $f->label = __('Sendy instalation URL', __FILE__); $f->description = __('Your Sendy installation URL without a trailing slash', __FILE__); $f->notes = 'http://www.example.com/sendy'; $f->value = $data['sendy_installation_url']; $wrapper->add($f); return $wrapper; } /** * [subscribeUserOrGuest description] * @param [type] $name [description] * @param [type] $email [description] * @param [type] $list_id [description] * @param [type] $success_url [description] * @param [type] $fail_url [description] * @return [type] [description] */ public function subscribeInSendy($name, $email, $list_id, $success_url = null, $fail_url = null) { $api_key = $this->data['sendy_api_key']; $sendy_url = $this->data['sendy_installation_url']; $postdata = http_build_query( array( 'name' => $name, 'email' => $email, 'list' => $list_id, 'boolean' => 'true' //set this to "true" so that you'll get a plain text response ) ); $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata)); $context = stream_context_create($opts); $result = file_get_contents($sendy_url.'/subscribe', false, $context); //check result and redirect if($result) { $this->wire('log')->save("newsletter", 'A new user subscribed to the site mailing list: '.$email); if($success_url) { header("Location: $success_url"); } } else { $this->wire('log')->save("error", 'Error occurred on subscribing '.$email); if($fail_url) { header("Location: $fail_url"); } } } }
  9. Hi @php ! I'd like to recommend to you a free PHP course by Jeffrey Way, the guy behind Laracasts: https://laracasts.com/series/php-for-beginners I think you're going to love it.
  10. Sergio

    I think you can take a look at the CSS "object-fit" rule. See this codepen: https://codepen.io/akb20/pen/EPoPpx
  11. Sergio

    Thank you, Ryan! Keep the excellent work up! Cheers!
  12. Sergio

    Forgot to say, welcome to the forums! ProCache is awesome. And if you were you, I'd take a look at @tpr's Latte module too. It's great!
  13. Sergio

    Yes. Unless I'm utterly wrong. Twig will render PHP files at runtime, and their output in the browser is the same output that's processed by ProCache. ProCache will render static version of the pages in /assets/ProCache-xxxxx/page-name/index.html that will be server by .htaccess rules (or Nginx rules, like I do)
  14. Sergio

    Yes, it will work. I use Latte template language, but it's pretty similar to Twig, and ProCache work flawlessly.
  15. Sergio

    Hi @Lemoratoire, welcome to the forums. You need to change the field settings. So, go to /setup/field/ find the Body field and on the Input tab change you can add some tags to the "Extra allowed content'" field or, for a full control of what HTML tags you can use, you'll need to disable the "ACF" and the "Use HTML Purifier" options. But beware that this opens a security risk if someone else is entering code beside yourself.