-
Posts
6,304 -
Joined
-
Last visited
-
Days Won
318
Everything posted by bernhard
-
Ajax-driven autocomplete search with native JavaScript
bernhard replied to Stefanowitsch's topic in Tutorials
You can just add a hidden field that is populated on page save from the content of each RepeaterMatrix or RockPageBuilder item. That field can then be queried by any search. In RockPageBuilder you get the benefit that you can simply add a dedicated method to every block: <?php // Text.php public function searchIndex() { return $this->body; } // Accordion.php public function searchIndex() { $index = ""; foreach($this->items as $item) { $index .= $item->headline . ": " . $item->body . "\n"; } return $index; } Thats not a built in feature but as all RockPageBuilder blocks are dedicated PHP files and classes things like this are super easy and clean to implement. This solution would obviously add additional data to the database, so fields are not queried directly. But that adds more options in presenting your search results. See here for some insights: -
Front-end edit of textarea images in child page
bernhard replied to MarkE's topic in General Support
I don't have much time, but do you think this is related? https://github.com/processwire/processwire-issues/issues/1706 -
Imagine you want to display an image on your website. Easy. Imagine you want to open the bigger version in a lightbox. Easy when using UIkit (or any other framework). Imagine you only want to add the lightbox link only if there is actually a larger version than the one displayed. Easy when using LATTE ? <div n:if="$img = $page->image" class="uk-background-muted uk-padding-small uk-text-center" uk-lightbox > <a n:tag-if="$img->width > 800 || $img->height > 400" href="{$img->maxSize(1920,1920)->webp->url}" > <img src="{$img->size(800,400)->webp->url}" alt="{$page->title}" /> </a> </div> This takes care of so many things with so little and clean code: the n:if on the outer div makes sure that we don't get any errors if no image is uploaded the n:tag-if makes sure that the anchor wrapper is only added if the original image is larger than the thumbnail Note that you can assign $img directly in the n:if condition. No need for an additional {var $img = $page->image} at the top. For some that might be too short, but I like it ?
-
RockPdf - Fast and fun TailwindCSS-like PDF creation for ProcessWire
bernhard replied to bernhard's topic in Modules/Plugins
v1.5.0 adds support for directly using fontawesome icon markup like <i class="fa-brands fa-youtube"></i> Just download FontAwesome and start using FontAwesome markup in your PDFs right away! ?? Docs: https://www.baumrock.com/en/processwire/modules/rockpdf/docs/fontawesome/ -
Hey @Jon sorry for the trouble, but I have a little present for you ? v1.5.0 adds support for directly using fontawesome icon markup like <i class="fa-brands fa-youtube"></i> The release is less than 10 minutes young and ready for download at https://www.baumrock.com/en/releases/rockpdf/ Docs are already there as well: https://www.baumrock.com/en/processwire/modules/rockpdf/docs/fontawesome/ Hope that helps you and many others ?
-
I'm working on improving the RockPageBuilder config page and added toggle buttons instead of checkboxes as they are a lot more intuitive (especially if you have default=yes toggles, where you'd need to use a negative meaning with checkboxes, eg "dont use the widgets feature" vs. "use widgets feature yes/no" The default toggle looks like this in ProcessWire: There it is not really obvious which value is selected. Is the grey one the active item or the shiny white one? I think this is much better: So I'm wondering if that should be a global default for toggles in AdminStyleRock - what do you think?
-
Ok... AI did indeed help with this problem again! I told cursor "@[link to this topic] can you help bernhard?" and it gave me instructions what I can do and check. So it told me to place a file in /.well-known/foo.txt to check if my rules work. That was a great "idea" because I was able to check the rules without issuing a cert all the time. I also had a look at PW's .htaccess file and looked how it is done there. Mixing everything together with some trial&error brought me to the working solution: RewriteEngine on # don't proxy requests to the .well-known folder RewriteCond %{REQUEST_URI} ^/\.well-known/.* RewriteRule ^ - [L] # send other requests to uptime kuma RewriteCond %{HTTP:Upgrade} =websocket RewriteRule /(.*) ws://localhost:3001/$1 [P,L] RewriteCond %{HTTP:Upgrade} !=websocket RewriteRule /(.*) http://localhost:3001/$1 [P,L] Maybe it helps someone else ?
-
I'm hosting uptime-kuma on my server as docker container behind a reverse proxy. The domain is set to redirect http://uptime.example.com to https://uptime.example.com Unfortunately my proxy does not let the letsencrypt request through and fails: [23-Jan-2024 10:19:05] INFO | check domain "example.com' [23-Jan-2024 10:19:05] INFO | certificate is valid until 2024-02-03 16:45:10 (11 days left) [23-Jan-2024 10:19:05] INFO | certificate is in renewal period [23-Jan-2024 10:19:05] INFO | renew cert [23-Jan-2024 10:19:05] INFO | Using certificate authority: "https://acme-v02.api.letsencrypt.org/" (PRODUCTION). [23-Jan-2024 10:19:05] INFO | Getting endpoint URLs. [23-Jan-2024 10:19:05] INFO | Account "foo" already registered. Continue. [23-Jan-2024 10:19:05] INFO | Requesting Key ID. [23-Jan-2024 10:19:05] INFO | Sending signed request to "https://acme-v02.api.letsencrypt.org/acme/new-acct". [23-Jan-2024 10:19:06] INFO | Start certificate generation. [23-Jan-2024 10:19:06] INFO | Token stored at: /home/panel/www/.well-known/acme-challenge/local-check-123456 [23-Jan-2024 10:19:06] INFO | URL: http://example.com/.well-known/acme-challenge/local-check-123456 | HTTP code: 200 | HTTP body (first 100 chars): <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" /> <meta name="viewport" conte [23-Jan-2024 10:19:06] ERROR | a Let's Encrypt error occurred: Local resolving checks failed for domain "example.com". Please ensure that your domain is locally resolvable! This is the proxy setup for HTTPS: # dont proxy letsencrypt requests ProxyPass /.well-known ! # uptime kuma directives ProxyPass / http://localhost:3001/ RewriteEngine on RewriteCond %{HTTP:Upgrade} =websocket RewriteRule /(.*) ws://localhost:3001/$1 [P,L] RewriteCond %{HTTP:Upgrade} !=websocket RewriteRule /(.*) http://localhost:3001/$1 [P,L] Any ideas? AI is not smart enough to help me ?
-
I don't think that this is true any more with HTTP2 because browsers can download multiple files at once. That's why I didn't implement something like this in RockFrontend. But I'm not sure ?
-
New URL hooks do not consider user language
bernhard replied to Juergen's topic in Module/Plugin Development
Hey @Juergen got bit by this again. I think the reason why the language is always the default one is because the hook adds to an URL that looks like the default language in PW - which makes sense. My solution today was to add two hooks for two languages: <?php public function init() { wire()->addHook("/create-cv", $this, "createCV"); wire()->addHook("/de/create-cv", $this, "createCV"); } public function createCV(HookEvent $event): void { // more code here $url = $this->wire->user->language->isDefault() ? $pdfs->first()->url : $pdfs->last()->url; $this->wire->session->redirect($url); } I created an issue on github: https://github.com/processwire/processwire-issues/issues/1871 -
Hey @Jon thx for the purchase and sorry for the trouble. I was confused because you posted your question in the old thread with old code. I'll update this threads title to make it more obvious! Anyways your code looks still strange. Why are you defining your fonts twice? Please have a look at the docs (https://www.baumrock.com/en/processwire/modules/rockpdf/docs/fonts/) and use one of the listed fonts exactly like shown in the examples. Once that works try your own font. If it breaks then, share your code and also your font (if possible) so that I can try to reproduce the problem. Thx PS: Where is that code that you posted? It has an additional bracket at the end...
-
Today I had to argue with a client about the use of tracking tools and loading external scripts from remote servers... I found the GDPR fulltext version, threw it to cursor chat and asked it: Its response: I double-checked the related articles and it looks quite accurate ? Ok I guess bard et al would have shown similar results, but cursor is always open ?
-
[Solved] RockPageBuilder Drag-and-Drop Compatibility with FireFox
bernhard replied to netcarver's topic in RockPageBuilder
I'm happy to announce that this is fixed in the latest version and will be merged next month ? We now have a toggle to enable/disable drag&drop and RockFrontend will now also completely hide all ALFRED UI elements if the topbar is hidden @dotnetic The screencast is already outdated, as the latest version will hide the move handle on the left to indicate that sortable is disabled ? You can try the latest release on https://pagebuilder.baumrock.com/ (the topbar is disabled on that demo). -
Printing custom field label on a Page, using the code
bernhard replied to Manaus's topic in General Support
Yes, but why? -
Had the same need and also needed to show the labels of the field in template context: echo $fields->my_field->getContext($page->template)->getLabel();
-
Couldn't you do something like this? $( document ).ajaxComplete(function() { yourFunction(); });
-
How to do fromdatetime and todatetime validation
bernhard replied to SIERRA's topic in General Support
Hey @SIERRA could you please read the community rules, especially the section about "Rules for posting"? You have posted several questions over the last years and often you just disappear. It might increase your chances to get helpful answers if you try to ask in a more polite and less demanding way and at least say thank you after someone replied and tried to help in his/her spare time for free. Have a nice weekend and good luck with your project. -
I think this is a big issue with quite an impact in many areas: https://github.com/processwire/processwire-requests/issues/176 https://github.com/processwire/processwire-issues/issues/1856#issuecomment-1878431067 We also have no events for modals, panels etc. We have a JS API for Inputfields already, so it would make sense to expand on that concept: https://processwire.com/blog/posts/pw-3.0.145/#inputfields-javascript-api I think this is one of a few cases where there are conceptual problems that Ryan should take more care about. I think these problems are not present enough in his head. Maybe someone can came up with a good writeup and maybe also propose a good solution? Sometimes that helps wonders, eg in 2020 I asked on stackoverflow about missing events in tabulator.info and the author of the library didn't seem to understand. Then in 2021 I posted the same thing in other words and he liked the idea a lot and it was instantly built into v5 and is now an integral feature of tabulator. I think it would be great to have a unified events system for the PW backend similar to https://tabulator.info/docs/5.5/events I could think of something like this: ProcessWire.on("repeaterItemAdded", function() { ... }); ProcessWire.on("panelClosed", function() { ... }); ProcessWire.openPanel(...); ProcessWire.addRepeaterItem(...); And I could imagine that Ryan likes the idea as I think code would get cleaner and easier to maintain - just like it happened with the Inputfields api some time ago...
-
Re-thinking ProcessWire Admin system (thought experiment)
bernhard replied to Jonathan Lahijani's topic in Dev Talk
That sounds like a huge task ? Do you have any reference for that? From what I read it's "maintenance-only", so we'll not see any new features. That's a different story then I guess. But of course I agree that it would be nice to get a more modern looking/working backend. But compared to other CMSs I think it's still really not bad. And it's very well thought out for all the complexity it needs to handle. https://blog.jqueryui.com/2021/10/jquery-maintainers-update-and-transition-jquery-ui-as-part-of-overall-modernization-efforts/ But remembering when AdminThemeUikit was born I guess Ryan will come up with a genius solution once it is necessary ? -
seems @teppo created an issue for this and it seems to be fixed now: https://github.com/processwire/processwire-issues/issues/1867
-
Hey @FireWire looks like fluency has problems with & ? I also checked on on older project - same problem. Reproduce: "Foo & Bar" and hit translate Thx ?
- 221 replies
-
- 1
-
- translation
- language
-
(and 1 more)
Tagged with: