Leaderboard
Popular Content
Showing content with the highest reputation on 04/21/2023 in all areas
-
I did my first talk ever yesterday @ PHP Meetup Vienna!! Once more everything was a lot more work than I first thought, but I'm quite proud of the result ? What do you think? Did I forget something important? It was really hard to put 10 years into one hour... The recording was not planned at first, but I thought I'd just give it a try and everything worked quite well ? If you like what you see please share it with others so that ProcessWire gets the attention that it deserves ? Special thanks to @gebeer for showing me ProcessWire in 2013 ?13 points
-
This week updates continued with various .js files in the core (for jQuery 3.6+ compatibility). A few external libraries were also updated to the latest versions, including jquery-tablesorter, jquery-ui-timepicker, magnific-popup and vex. And finally, InpufieldTinyMCE has been added to the core! That's a lot of updates, but there's not a lot more to write about these updates because we covered the jQuery updates last week, and InputfieldTinyMCE has been the topic of several past posts. But now we've got everything together and running smoothly in ProcessWire 3.0.216. I think we're now ready to focus on getting the next main/master version out in the coming weeks. There likely won't be an update next week because I'll be traveling for a few days, but will be back to a regular schedule the following week. Thanks for reading and have a great weekend!13 points
-
@matjazp Thanks, I have updated all of those and others along the way. The only one I didn't update was Selectize because we're using what's called the "standalone" version, and I don't see it mentioned at all in the current version, so seems like there's something I'm missing and figure it's better to leave that one for now. (Especially if the new version isn't yet updated for jQuery 3.x.) Regarding Magnific, I had a look at the mentioned security leak and I don't think it's an actual security issue, if I understand correctly. It looks like it would require someone able to manipulate the image filename to insert XSS into the actual filename. If someone can do that then the installation would already be compromised whether Magnific is there or not.2 points
-
Ryan, thank you for all the updates!!! It's a lot of work, if you think I could help you more, please let me know. Here are a few more, I'm sure that's not all: /wire/modules/Inputfield/InputfieldSelector/InputfieldSelector.js .removeAttr('disabled') -> .prop('disabled', false); /wire/modules/InputfieldTinyMCE/plugins/pwimage.js .load(), .click() /wire/modules/Jquery/JqueryUI/panel.js .resize() Those listed below are from third parties; some are staled at the development. Replacing them with the new version require more testing, so I'm not sure if it's worth your time. /wire/modules/Process/ProcessPageEditImageSelect/cropper/cropper.js .load(), .isFunction() /wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-sliderAccess.js .click() /wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-timepicker-addon.js multiple deprecations Consider updating jQuery Timepicker Addon from v 1.6.1 to 1.6.4 with this fork: https://github.com/DanielTOsborne/jQuery-Timepicker-Addon (see attached file) /wire/modules/Jquery/JqueryMagnific/JqueryMagnific.js .isFunction(), .focus() Consider upgrade to v1.1.0 (see attached file) and also check this potential security leak: https://github.com/dimsemenov/Magnific-Popup/issues/1189 /wire/modules/Jquery/JqueryUI/vex/scripts/vex.combined.js .click(), .bind() Latest version: https://github.com/HubSpot/vex/archive/refs/tags/v4.1.0.zip /wire/modules/Jquery/JqueryUI/selectize/js/standalone/selectize.js .focus() Latest version: https://github.com/selectize/selectize.js/archive/refs/tags/v0.15.2.zip but still with deprecated methods ? JqueryMagnific.zip timepicker.zip2 points
-
You'll need to write this line as... } else if($dl->ext() == "doc" or $dl->ext() == "docx") { ...or else it will always evaluate as true regardless of the extension. A good candidate for rewriting as a switch statement too.2 points
-
I would use a Pages::published hook for that. Assuming that the "help request" is a single item (I'll call it job in my example) on your "job board" and that both users and jobs have a page reference field "interests" that links to the area of interests, you can attach that published hook and everytime a job is published, those emails will get send. Dummy code: wire()->addHookAfter('Pages::published', function(HookEvent $event) { $page = $event->arguments(0); if($page->template !== 'job') return; // build selector value for interests, e.g. 1234|3456|5678 $interests = implode('|', $page->interests->explode('id')); // get users who are interested in this job, assuming the template for users is 'applicant' $interestedUsers = wire('pages')->find("template=applicant, interests={$interests}"); // either send emails directly foreach ($interestedUsers as $u) { // logic for sending emails } // display send result status message wire()->message('Notifications sent', 'success'); // or create a page for job-notifications and redirect there }); Sending emails directly from this hook will take some time until the admin user gets a message displayed. So this might not be optimal. As an alternative you could create a job-notification page and redirect the admin there. On that page you can list the interests and intersted users and a sent status as well as a send/resend button and handle the sending there. With these separate notification pages available in the system you could build a custom Lister for an overview which makes it more convenient to interact with the notification system, see sent statuses etc.2 points
-
2 points
-
I have been using HTMX recently and it really is a very good option. Of course all of its functionality can be achieved using the Processwire API, and including partial files in the template file. But it would be wonderful to have some kind of facilities in our framework. Maybe with a new method in the PageRender class, that allows to select specific elements of the template file markup. The following is a simple idea based on the Markup Regions syntax: <pw-region id="content"> <h1><?= $page->title ?> <?= $page->summary ?> <h2>Contact Details</h2> <div id="contact_info" pw-fragment> <p><strong>$page->contact_name</strong></p> <p>$page->contact_address</p> </div> <h2>Social Channels</h2> <div id="total_likes" hx-swap-oob="true" pw-fragment> <a href="https://www.facebook.com/">$page->likes</a> </div> <p>Please, Call Us!</p> </pw-region> Since I'm not a programmer and I don't really understand very well how PW works inside, perhaps one of the following options can work to execute the rendering of the fragments (It can use the Find method that Markup Regions has for HTML tags) $output = $page->render("#contact_info#total_likes"); $output = $page->render("basic-page.php#contact_info,total_likes"); $output = $page->render("fragment=contact_info|total_likes"); $output = $page->fragment("contact_info|total_likes")->render(); $output = $page->render()->fragment("contact_info|total_likes"); $output = $page->renderFragment(["contact_info","total_likes"]); wireFragment() Of course this method does not use the append file of the "_main.php", perhaps doing a: $this->halt(); Laravel Blade has this already implemented for precisely the same purpose. Check this video: https://youtu.be/3dPUsXsDZsA https://htmx.org/essays/template-fragments/ @ryan what do you think about this? Everyone, would this be a good idea? ..or something similar?1 point
-
By the way @bernhard, this is my first project using RockFrontend, and I could just kiss you ? Rockfrontend with Latte + Tailwind + Alpinejs is such an awesome mix.1 point
-
I'm only dealing with video, but this is the latest I used: <?php // greatest common divisor function gcd($a, $b) { return $b ? gcd($b, $a % $b) : $a; } $padding = $video->height / $video->width * 100; $padding = str_replace(",", ".", $padding); // css doesn’t like commas $ratio = gcd($video->width, $video->height); $ratio = $video->width / $ratio . " / " . $video->height / $ratio; echo "<div class='video' style='aspect-ratio:$ratio; padding-top:$padding%;'>$video->html</div>"; CSS: .video { aspect-ratio: 16 / 9; width: auto; max-width: 100%; height: auto; max-height: 100%; padding-top: 56.25%; } .video > iframe { display: block; width: 100%; height: 100%; position: absolute; left: 0; top: 0; } /* if aspect-ratio is supported */ @supports (aspect-ratio: 16/9) { .video { padding-top: 0 !important; } .video > iframe { position: static; } } Constraining things in the y-axis has always been one of my biggest pain in CSS... but aspect-ratio goes in the right direction in that you can just go ahead and set the max-width/height to 100% and it will adapt nicely within its parent Wait actually some testing goes against what I just wrote, I have to test further ? It does work but as always with CSS there will be weird edge cases. I wasn't using it much before but now the support is quite reasonnable.1 point
-
Haaaa! I did miss something obvious. Safe bet with me. I was under the impression I could short form that, not sure where I got that idea but it didn't throw an error so..... Thanks Robin. If more file types are added to the list then a switch is absolutely what I'll use.1 point
-
Unfortunately I have nothing to contribute, but I tested your exact code on a PW 3.0.183 installation of mine and it worked as expected, so maybe the problem lies somewhere else?1 point
-
I'm testing with $config->debug="dev" and there are no major issues. Thanks for the update, @ryan I found these js files that might need some updates for the lastest jQuery (deprecations): /wire/templates-admin/scripts/install.js /wire/templates-admin/scripts/inputfields.js (focus) /wire/modules/AdminTheme/AdminThemeDefault/scripts/install.js /wire/modules/AdminTheme/AdminThemeDefault/scripts/main.js /wire/modules/AdminTheme/AdminThemeReno/scripts/main.js /wire/modules/System/SystemNotifications/Notifications.js /wire/modules/Process/ProcessRole/ProcessRole.js /wire/modules/Process/ProcessProfile/ProcessProfile.js /wire/modules/Process/ProcessPageEditLink/ProcessPageEditLink.js /wire/modules/Process/ProcessCommentsManager/ProcessCommentsManager.js /wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-sliderAccess.js (upgrade to 1.6.3) /wire/modules/Inputfield/InputfieldDatetime/timepicker/jquery-ui-timepicker-addon.js (upgrade to 1.6.3) /wire/modules/Inputfield/InputfieldPageTable/InputfieldPageTable.js /wire/modules/Inputfield/InputfieldSelector/InputfieldSelector.js /wire/modules/Inputfield/InputfieldPageAutocomplete/InputfieldPageAutocomplete.js /wire/modules/Jquery/JqueryWireTabs/JqueryWireTabs.js (eq) /wire/modules/LanguageSupport/LanguageTabs.js /wire/modules/Jquery/JqueryTableSorter/widgets.js /wire/modules/Jquery/JqueryTableSorter/JqueryTableSorter.js (new version 2.31.3 also has issues with deprecated function calls) /wire/modules/AdminTheme/AdminThemeUikit/layout/source/stable/plugins/jquery.layout.buttons.js I would also update ckeditor to v4.21.0 and uikit to v3.16.14. EDIT: Ryan, I tested with this forked version of JqueryTableSorter: https://github.com/DavidAnderson684/tablesorter and there are no deprecations in the lastest version of jQuery. I'm attaching a zip file with the files to be replaced in /wire/modules/Jquery/JqueryTableSorter/ JqueryTableSorter.zip1 point
-
There are some vote on this, please say more, which one ? ?1 point
-
I figured it out. Since PageRender::renderPage is providing the rendered output in $event->return; rather than the function returning it (since it is actually a hook to a non-existent Page::render), then you have to do the same. As a result, this code in your before hook function should work: $otherEvent = $event->arguments(0); // grab event provided to PageRender::renderPage $otherEvent->return = "<p>Hello World</p>"; // plug in our value $event->replace = true; // prevent PageRender::renderPage from being called1 point