• Content count

  • Joined

  • Last visited

  • Days Won


Sergio last won the day on July 19 2017

Sergio had the most liked content!

Community Reputation

442 Excellent

About Sergio

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

Profile Information

  • Gender
  • Location
    Belo Horizonte, Brazil

Recent Profile Visitors

4,989 profile views
  1. @BitPoet, you're on fire!! It will be useful to a lot of people, especially beginners.
  2. I can only speak by my experience with them, so: ProCache: 100% support ProDrafts : 100% support FormBuilder: almost all fields support, but Options and Select fields. But there's a workaround. ProFields: I think only Table won't accept multilanguage fields. The other profields work fine. ListerPro: I didn't use it yet, but I think it fully supports ML's as it is a extension of the basic lister.
  3. This is awesome, @Jonathan Lahijani!!! Great work!! For those eager to learn CSS Grid, I recommend this excellent (and free) course by Web Bos:
  4. Came back to say that the regex example I gave can also work without regex, because we're not actually using its power. So, if you just add "map" and "carte", one per line, on the URL Segment field, in the template settings, it will also work. Regex is more appropriate when you have cases like these: //to get segments like /export-json or /export-xml regex:^export-(json|xml)$ //to get segments like "2018/episodes" regex:^\d{4}/episodes$ //to get segments like "category/ebooks/". I used this when there's no category pages associated with the template, just options of a Options field. regex:^category/[a-z]+$
  5. No problem! Regex to the rescue! Take a look at other examples here:
  6. URL segments that you enable on the template settings are just strings, not selectors, so ProcessWire won't be able to do this kind of check. But you can accomplish it by doing the following: On Template Settings, add a regex on the URL Segments field like: regex:^(map|carte)$ On your template code, add a check: // we are only using 1 URL segment, so send a 404 if there's more than 1 if($input->urlSegment2) throw new Wire404Exception(); if($input->urlSegment1) { //if there's any segment that matches the ones you specified on the Template Settings, PW will proceed. //do your code } Going to or /carte will pass the conditional.
  7. <div class="row"> <?php $i = 0; foreach ($page->umf_img as $image) { echo "<div class='one-fourth column refs'><img src='$image->url'></div>"; if ($i % 4 === 0) { echo '</div><div class="row">'; } $i++; }?> </div>
  8. Hum, I think you have a similar problem I related here:
  9. Why not add the new role to the user and then remove his/her other role?
  10. You can access a repeater field directly by its name, no need to use $page->template.. So, to get a title field inside a repeater, you just need: $repeater = $page->your_repeater_name; foreach( $repeater as $rep ) { echo $rep->text_field_name; echo $rep->page_reference_field_name->title; //output the title of the page that's referenced }
  11. Ryan, great work, as always, on the "owner" selection! Very cool stuff!! I'm eager to use it someday!
  12. Thanks! I've read that page and this one: In the website I mentioned, I have the homepage as "/" and hreflang of "en". So I'll add a third hreflang tag with x-default value. The other language it "/pt". The user is not redirect upon arrival, he/she must select the language. <link rel='alternate' hreflang='x-default' href='' /> <link rel='alternate' hreflang='en' href='' /> <link rel='alternate' hreflang='pt' href='' /> Actually, after reading it again, in this case I think I should have only to values: <link rel='alternate' hreflang='x-default' href='' /> <!-- default language is english for all users --> <link rel='alternate' hreflang='pt' href='' />
  13. Hey @chrizz. I'll read more about x-default, thanks! About the lang_code field. It's a custom field that I add to all my multilanguage projects. This is useful because I set the homepage path to be "/" to the default language so in the hreflang value, I output the real lang code, like "en" or "en_US" for instance.
  14. I may be missing something, but isn't this as simple as: <?php // handle output of 'hreflang' link tags for multi-language // this is good to do for SEO in helping search engines understand // what languages your site is presented in foreach($languages as $language) { // if this page is not viewable in the language, skip it if(!$page->viewable($language)) continue; // get the http URL for this page in the given language $url = $page->localHttpUrl($language); // hreflang code for language uses custom lang_code field $hreflang = $language->lang_code; // /en or /pt in this website // output the <link> tag: note that this assumes your language names are the same as required by hreflang. echo "\n\t<link rel='alternate' hreflang='$hreflang' href='$url' />"; } ?>
  15. Hello fellow PW devs! This is a short story from the server management trenches. These past couple of days trying to solve an unexpected problem: after DigitalOcean patched the droplets in NYC3 region last week, my client's droplet became almost useless and went down a couple of times. The droplet has 2GB RAM and was running Ubuntu 16.04 that was updated to kernel 4.4.0-116 after the patch. The server was provisioned using Forge ( After sshing into it, and running "top" I've noticed the cause: "php-fpm7.1" processes (3-5 instances) were spiking the CPU to 100%. This was very odd, as the CPU usually kept around 33% most of the time. The site uses ProCache and markupCache and was getting around 800-1000 visits/day last week. I checked everything on PW's side and nothing seemed out of place, so I went restarting PHP and Nginx but the problem continued. I checked access logs and no suspicious activity shown up. I upgraded PHP to 7.2 to see if anything will changed but the problem continued. My only guess after all that is that the droplet in question got screwed up somehow, because I didn't see any complaints on the web of other people getting the same problem on DO (But I confess that I did a quick Google search only). So in the end I decided to create a new droplet, now with 2 CPU cores and kept the 2GB (1 extra core and $5 cheaper ). Reinstalled PW there and pointed the floating IP to this new server. The installation went smooth but to one issue: error log started to show messages of MySQL showing "to many files" error when the users were searching. I've never encountered this message before, so after reading some StackOverflow posts, I changed config file to remove its file limit ( Everything is normal now, but I think I'll never discover what truly happened. Anyone else had this kind of problem with MySQL before?