Jump to content

BitPoet

Members
  • Content Count

    931
  • Joined

  • Last visited

  • Days Won

    43

BitPoet last won the day on August 12

BitPoet had the most liked content!

Community Reputation

2,178 Excellent

4 Followers

About BitPoet

  • Rank
    Hero Member

Profile Information

  • Gender
    Male
  • Location
    Near Munich / Germany
  • Interests
    programming, writing, scuba diving, long distance hiking

Recent Profile Visitors

6,295 profile views
  1. Didn't think of image variations (which you get when you resize/edit the image in CKEditor's image dialog), so that's the likely reason. @Robin S' solution should catch these too.
  2. The first one is template syntax, the second one plain PHP. echo "<li><a href='{$parent->get('url_redirect|url')}'>{$parent->title}</a></li>"; // or: echo "<li><a href='" . $parent->get('url_redirect|url') . ">{$parent->title}</a></li>";
  3. Also quite helpful in such scenarios is PW's page-edit-created permission that prevents editors from editing each others articles.
  4. Here's a quick&dirty snippet: // Make sure to adapt the name to your image field here: $baseUrl = $page->images->url; $match = []; preg_match_all( '~<img[^>]+src=([\'"])(' . $baseUrl .'[^\'"]+)\\1~is', $page->body, // Adapt the name of your richtext field if not "body" $match ); $seen = $match[2]; // Again, adapt the image field name foreach($page->images as $img) { if(! in_array($img->url, $seen)) { // Output image } }
  5. Doesn't the "~=" operator do what you want?
  6. No "clean" way. The only, and not 100% reliable, way I can come up with would be to set the version number of the "local" version much higher than the official one.
  7. Are your PHP script and the CSV file both in UTF8?
  8. To me it looks like it should definitely be Spreadsheetname!1:2 since the API complains that it doesn't like writing outside of the given range. It likely behaves differently depending on whether overwrite is true or false, so it might not have popped up in practice (FormBuilder entries will be passed through appendRows). I'm going to run a few tests.
  9. The EEC just explained what has been the law in Europe long before the GDPR. The German publisher Heise for example has released a jquery plugin with data protection conforming social buttons in 2011 for this reason (link to fork with English docs). The buttons there act as placeholders and only load resources from the respective sites when clicked once. It would apply to embedded content from any non-EU site, but especially to all the big players who are known to practice data harvesting and aggregation.
  10. $count_arr = []; foreach($page->my_repeater as $rep) { $name_normalized = ucwords(strtolower($rep->lastname . " " . $rep->firstname)); $count_arr[$name_normalized]++; } arsort($count_arr, \SORT_NUMERIC); $leaders = array_slice($count_arr, 0, 5); The caveats are names with prefixes, like Scottish McSomething, which will end up being Mcsomething, and that there's no sorting among names with equal vote count.
  11. If there aren't any 40x errors, look into the returned content for JqueryUI.js and its friends. The web server might be inserting error or warning messages that break the parsing.
  12. Do you see any errors in the browser's developer console, or any not loaded scripts in its network tab?
  13. I'd use ?: instead of ??. At least if you can trust the truthy-ness of the field's value if set (which should be okay for keywords and description). And... though not necessarily better, I sometimes add a generic method to the Page class to abstract away logic from the template. // in site/ready.php: wire()->addHook("Page::getWithDefault", null, function(HookEvent $event) use($pages) { $page = $event->object; $property = $event->arguments(0); return $page->get($property) ?: $pages->get(1)->get($property); }); Then your template code boils down to <?= $page->getWithDefault("meta_description") ?>
  14. You can use WireArray's explode method to get the required property(s) from your repeater. "socials" => $m->socials->explode(['title', 'url']) Pass it a function instead of a property name or names to add fancier processing: "socials" => $m->socials->explode(function($item, $key) { return [ "name" => $item->title, "link" => $item->url ]; })
×
×
  • Create New...