Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/02/2020 in all areas

  1. Note sure if it suits your needs or not, but it's really easy to include https://dibiphp.com/ into PW and then you can query those sqlite databases within your template files / modules. You can put this in your init.php file: require_once __DIR__ . '/vendor/autoload.php'; $this->wire("dibi", new Dibi\Connection([ 'driver' => 'sqlite', 'host' => hostname, 'username' => user, 'password' => pass, 'database' => dbname, ])); and then you can query using the global $dibi variable like this: $result = $dibi->query('SELECT * FROM mytable'); foreach ($result as $row) { echo $row->fieldname; }
    5 points
  2. @Robin S is a genius! ? Based on his posts in the github issue I did the following and finally got the bug fixed (it seems): For Server Side Resizing: Search for "$corrections = array(" in all your files. You should find 3 files: Replace those arrays with this one: $corrections = array( '1' => array(0, 0), '2' => array(0, 1), '3' => array(180, 0), '4' => array(0, 2), '5' => array(90, 1), '6' => array(90, 0), '7' => array(270, 1), '8' => array(270, 0) ); This did already fix my issue. Client Side: Replace PWImageResizer.js with this file created by @Robin S and delete the old minified version PWImageResizer.min.js to make sure that the new version is loaded: https://github.com/processwire/processwire-issues/files/4660217/PWImageResizer.zip Would be great to hear if that also fixed your issue @Mikael ? Thx again @Robin S for the great work!!
    1 point
  3. This module is great, my biggest problem is that you have to edit the field to set default values site wide. I'd like my clients to manage some of that themselves in the settings area i have setup. Can the Default Values of the field be inherited from another page? I guess I could write a hook to edit the field when saving a certain template but wondered if there was an easier solution.
    1 point
  4. As requested, in version 1.2.7 the function is now public. ?
    1 point
  5. You have the "Render Banner and Header Content Manually" option in the module settings. After checking it you can insert the module generated code wherever you'd like. The script tags are generated by the folowing snippet: $modules->get('PrivacyWire')->renderHeadContent() Disclaimer: didn't tested my suggestion, this is just what I saw in the module's code. Why would you want to include both PrivacyWire.js and PrivacyWireUnstyled.js? AFAIK they only differ in including or not the module's CSS for the frontend. Including PrivacyWireUnstyled.js would only waste resources if PrivacyWire.js is included.
    1 point
  6. @dotnetic had a problem after upgrading to the latest PW. I've pushed a fix for this today to support PW 3.0.158+ https://github.com/BernhardBaumrock/RockFinder/commit/7d8e0a33a5ed0d0ffaf2b009689f523f7ec14ef6
    1 point
  7. I'm having same issue on Aruba servers (Italy) in the installation process, I commented out this lines: # Note that some web hosts don't support this. If you get a (500) error, try commenting out this # SetEnv line below. <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE On </IfModule> Now It works
    1 point
  8. Thanks for the detailed response @Robin S! That's exactly what I was looking for, I'll use that. Would be nice to be able to go without passing the current $page in, but I understand why it's required, I guess it doesn't matter ?
    1 point
  9. @adrian This is really neat...thanks for posting!
    1 point
  10. You could get the field without going via the template fieldgroup, but to get the inputfield and selectable pages I think it's compulsory to supply a Page object. In the case of selectable pages, it's quite common for the selectable pages to change depending on the current page which is perhaps why it's a compulsory argument to getSelectablePages(). I guess you could get the inputfield settings that determine the selectable pages (i.e. parent_id, template_id, findPagesCode, findPagesSelect or findPagesSelector) and then use that to build a $pages->find() selector but that seems like more trouble than supplying a $page argument. For a Page Reference field that isn't in a repeater I think the simplest way is: $options = $page->getInputfield('my_page_ref_field')->getSelectablePages($page); But a Page Reference field inside a repeater is a special case because where the selectable pages depend on the current page, the current page is interpreted as the editable page that contains the repeater, not the repeater page that contains the inputfield. There is discussion about this here: https://github.com/processwire/processwire-issues/issues/479 So you might do something like this: $options = $fields->get('my_page_ref_field')->getInputfield(new Page())->getSelectablePages($page);
    1 point
  11. Proper error handling is definitely on the implementation list. I guess it just got upgraded to a higher priority item now that we've seen that. For what it's worth I've been playing around with the API for months and haven't experienced that. Not downplaying the importance of error handling, just hoping that means they're correct when they say that it happens seldomly. I'll be pushing more work when I can get some time dedicated to the module. I'm slammed at work right now but I will prioritize error handling when I'm back on the project. Thank you for reporting this here as someone might look for answers if this happens again, even with error handling.
    1 point
  12. Ok, so here is the reply from DeepL "We experienced a temporary technical problem earlier today. As you noticed, the issue has already been resolved. It is rather seldom that we experience outrages. Should this occur, we strive to resolve the issue as fast as possible, as you have seen it today." Nothing terribly illuminating, but it does suggest that outages are to be expected (as I suppose they are with any service), but I think this means that we do need a friendlier way of catching and handling errors.
    1 point
  13. I just added the support for videos embedded via the youtube-nocookie.com domain to the Textformatter. Fixed in 0.4.3 Thank you all for noticing and helping to find the missing URL ?
    1 point
  14. TextformatterPrivacyWire.module works fine here as long as: 1) the iframe contains www.youtube.com/embed/ and not www.youtube-nocookie.com/embed/ and 2) as long as its the second textformatter (or at least the textformatter after VideoEmbed). Just played around with it here in my testing setup.
    1 point
  15. As we see huge progress in terms of privacy (GDPR/DSGVO) over at PrivacyWire with this module, wouldn't it be an awesome addition to embed YouTube videos with the "no cookie" domain in order to allow even more privacy? I worked my way through to this in a hacky way (see below) in the past but maybe this could be an option some day in the official module itself. $embedCode = str_replace('youtube.com', 'youtube-nocookie.com', $data['html']);
    1 point
  16. For anyone that is interested in doing the same this seems to have worked. Place this in admin.php, before the controller.php line: $config->styles->add('/assets/css/custom.css'); And then add this in your new custom.css file: form#selected_image_settings p#wrap_info span#action_icons span { display: none; } form#selected_image_settings p#wrap_info span#action_icons span#description_action { display: block; } span#selected_image_pixels, span#selected_image_checkboxes { display: none; } Now you just get the image description button. Make sure you check the Skip width attributes on image tags in the Page Edit Image config or set width and height to auto in your main site CSS. I will test it out a bit more but seems to be working fine for now.
    1 point
  17. Hi all, To those who have asked questions, just noting here that I have seen them and will answer you when I get a bit of time. I will respond by editing the first post, whenever possible, just so we have Q&As in one easy-to-find location. Thanks.
    1 point
  18. Suppose you have an images field and you want editors to upload a specific number of images to that field. Using a hook in /site/ready.php you can display a field error in Page Edit if the number of images in the field does not match the required number. Just like the standard "required" behaviour, the requirement does not prevent the field being saved if the number of images is not correct so you would still want to check the image count in your template. $wire->addHookAfter('InputfieldImage::processInput', function(HookEvent $event) { $inputfield = $event->object; // Only for this field if($inputfield->hasField != 'images') return; // Only in ProcessPageEdit if($this->process != 'ProcessPageEdit') return; $page = $this->process->getPage(); // Only for this template if($page->template == 'home') { if(count($inputfield->value) !== 4) $inputfield->error("Please upload exactly 4 images to this field"); } });
    1 point
  19. Hey Marty - sorry for taking so long to get back to you - busy day So you could do this with Ajax calls to a PHP script like the following. It would be called whenever someone clicks on a property. This would be a toggle approach, which may or may not be appropriate depending on how the site is set up. In this case, the cookie would store an array of the property IDs. $pid = $page->id; if (!in_array($pid, $favs)) { //add to the array if not already in it $favs[] = $pid; } else { $key = array_search($pid, $favs); unset ($favs[$key]); //remove from array if already in it } $data = base64_encode(serialize($favs)); setcookie('property_favs', $data, time() + 86400 * 100, '/'); Then to read the cookie back in, something like this: $favs = unserialize(base64_decode($_COOKIE['property_favs'])); That will give you an array of page ids that you can use to populate the user's favourites. If you want to go with a combination of javascript and PHP, you can do that also. Firstly, I recommend taking a look at this jquery helper: https://github.com/carhartl/jquery-cookie You can add the property/page id to the cookie using that and then retrieve on page load using PHP. Instead of storing an encoded array, you can also store a separated list of IDs. This example is using raw javascript: if(readCookie('property_favs')){ document.cookie = 'property_favs=' + readCookie('property_favs') + escape('|' + pid) + '; path=/'; } else{ document.cookie = 'property_favs=' + escape('|' + pid) + '; path=/'; } So if the cookie exists, then read it and add on a new pid after a pipe character and escape it so it can be stored in the cookie. If the cookie doesn't exist, create it with the current pid. The jquery cookie plugin will make this cleaner. Remember to use your developer console as it will show you the current cookie contents. In Chrome it is one of the options under Resources. In Firefox I seem to remember installing a plugin for Firebug to analyze cookies. It's really pretty easy once you play around with it. Let us know if you have any specific questions.
    1 point
×
×
  • Create New...