Jump to content

bernhard

Members
  • Posts

    5,466
  • Joined

  • Last visited

  • Days Won

    246

Everything posted by bernhard

  1. I fear I don't have any idea for you, but have you considered using DDEV? I think it would be worth trying, because it is such a great and hassle free dev environment and maybe your issue will be solved as well!
  2. Hey @adrian tracy debugger creates links like this: vscode://file/%2FUsers%2Fbernhard%2Fbaumrock%2Fbaumrock.com%2Fsite%2Fready.php:8 With the latest vscode these links don't work any more. Turns out that the issue is the file// instead of file/ I've changed that in RockFrontend and RockMigrations and all fine again. See https://github.com/microsoft/vscode/issues/197319 Not sure why I get those %2F instead of / ? Would be great if you could push a fix for this. I tried to find it myself but seems I didn't find the right spot. Thx in advance! PS: Just did an update to the latest version and got this error: Error: Undefined constant Tracy\Debugger::Version in /var/www/html/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/assets/bar.phtml:15 Stack trace: #0 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(119): require() #1 /var/www/html/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Helpers.php(364): Tracy\Bar->Tracy\{closure}() #2 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(120): Tracy\Helpers::capture(Object(Closure)) #3 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Bar/Bar.php(89): Tracy\Bar->renderPartial('main') #4 /var/www/html/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/DevelopmentStrategy.php(123): Tracy\Bar->render(Object(Tracy\DeferredContent)) #5 /var/www/html/site/assets/cache/FileCompiler/site/modules/TracyDebugger/tracy-2.10.x/src/Tracy/Debugger/Debugger.php(309): Tracy\DevelopmentStrategy->renderBar() #6 [internal function]: Tracy\Debugger::shutdownHandler() #7 {main} (stored in /var/www/html/site/assets/logs/tracy/exception--2023-11-05--11-52--6565da4fb6.html) PPS: Weird - now everything seems to work with the old links as well! Don't know what's going on, but I think changing to the official vscode://file/... format would be a good idea nonetheless 🙂
  3. As far as I understand pagefileSecure makes PW serve ALL pagefiles via PHP and not directly from apache, right? So I'm quite sure whatever you need should be doable with some hooks. I'm also quite sure that it will not work "as expected" by default, as this is a use case that I definitely did not into account. 🙂
  4. Ok I have an update on this one. Actually I'm not sure about this feature any more. Today I had to translate some elements and I changed the default text, which is german. Then I clicked on the english tab to see what text I have in this field. The field was empty, so I clicked on "translate to all languages", which wiped my german field 😄 To be honest I'm not sure how useful the "translate to all languages" button is on non-default languages. Also when viewing a non-default language I think there should be a button to pull text from the default language, as that is most likely what you want to do I guess. But I'm really not sure, just wanted to mention that here before you push something to the main branch...
  5. Sure! RockPageBuilder works with any framework or without any framework. All the parts that have to work everywhere are custom built, for example the UI on hover (which uses RockFrontend's ALFRED) and also the drag and drop sortable feature. Check out this section in the installation video: https://www.youtube.com/watch?v=ulImisUs7zQ&t=362s
  6. Thx. I have not built a single site without it over the last 3 years 🙂 Sure! It stores pages under a hidden page in the pagetree that you can show for superusers: I have not tried to be honest, but I don't see a reason why it should not? Could you give me some context to think about it? What would you want to do? Well - it depends. Technically you can place those files wherever you want. The module has an API to load those blocks, eg $pagebuilder->loadBlocks('/path/to/dir'); The easiest way to use it is to stick with the defaults, because then everything happens automatically and you don't need to understand the module's inner workings. The files itself are necessary for it to work, of course - BUT: That does not mean that those files have to be writable by the system on production. You could for example just create those blocks on your dev environment and then just push those files to git and deploy. That's what I'm doing all the time. You could even disable all migrations if you want. But then you'd have to push your db changes to production manually or create the templates and fields manually, which would be tedious of course. Technically all blocks are just custom page classes: Demoblock extends Block extends Page Does that answer your questions? Thx! That's fixed 🙂
  7. I'm thrilled to announce the official release of RockPageBuilder, the game-changing tool that's set to transform your web development journey (at least ChatGPT says so 😉😅)! With its brand new drag-and-drop interface RockPageBuilder is your secret weapon for creating outstanding ProcessWire-based websites. Get a taste of the future of web development by visiting the demo page at https://pagebuilder.baumrock.com/ and exploring the RockPageBuilder documentation at https://www.baumrock.com/en/processwire/modules/rockpagebuilder/docs/ Don't miss out on this exciting opportunity to elevate your web development game. Get ready to rock with RockPageBuilder! 🎸🖥️ Early Bird Sales until 30.11. https://www.baumrock.com/processwire/module/rockpagebuilder/ Here is a quick demo video: And here is how to install it from scratch in under 5 minutes: Some showcase projects are already in the pipeline 😎 So be sure to subscribe to https://processwire.rocks/ or to https://www.baumrock.com/rock-monthly/ Have a great weekend!
  8. Yes. myrace is just an inputfield that we added during runtime. It is not a field of the page, so $page->myrace will not work. But it is an inputfield of the form that is submitted, so the input post data will have that information available and we can use it for our further processing.
  9. Just tried it and the new link feature is absolutely awesome. That saves so much time when translating content! Thank you very much. Translate to all is also nice, thanks! 🙂
  10. Thx for the additions 🙂 That would be a great use case for using $page->meta() ! It's already there without doing anything and it's also a lot easier to manipulate meta data from within a hook than updating a hidden field's content. Everything needed is doable with just a few lines of code without any modules. The modules do not help here. Quite the contrary, they make things more complicated and less robust. To add a runtime markup field to page edit: <?php $wire->addHookAfter("ProcessPageEdit::buildForm", function (HookEvent $event) { /** @var InputfieldForm $form */ $form = $event->return; $page = $event->process->getPage(); // custom rules where to add the field // eg add it only to pages with template "home" // otherwise exit early and do nothing if ($page->template !== 'home') return; $form->insertAfter([ 'type' => 'markup', 'name' => 'mymarkup', // we need that later ;) 'value' => '<h1>I am a custom markup field</h1>', ], $form->get('title')); }); In this markup field you can show any HTML/PHP markup you want. Now we can also add dynamic selects - also just a single and quite simple hook: <?php $wire->addHookAfter("ProcessPageEdit::buildForm", function (HookEvent $event) { /** @var InputfieldForm $form */ $form = $event->return; $page = $event->process->getPage(); // custom rules where to add the field // eg add it only to pages with template "home" // otherwise exit early and do nothing if ($page->template != 'home') return; // data coming from your file $races = ['foo', 'bar', 'baz']; // add all options $f = new InputfieldRadios(); $f->label = 'Choose your race'; $f->name = 'myrace'; foreach ($races as $race) { $f->addOption($race, "Use Race '$race' for something"); } // now add it after our markup field: $form->insertAfter($f, $form->get('mymarkup')); }); And finally we save the data: Another small hook 🙂 <?php $wire->addHookAfter("Pages::saveReady", function (HookEvent $event) { // get the selected race from the radio input // we sanitize the input to make sure it is a string $race = $this->wire->input->post('myrace', 'string'); if (!$race) return; // save selected race to page meta data $page = $event->arguments(0); $page->meta('myrace', $race); }); Of course we have now two hooks for the same process, so we can combine those two to one and we end up with two hooks which should all you need: <?php $wire->addHookAfter("ProcessPageEdit::buildForm", function (HookEvent $event) { /** @var InputfieldForm $form */ $form = $event->return; $page = $event->process->getPage(); // custom rules where to add the field // eg add it only to pages with template "home" // otherwise exit early and do nothing if ($page->template != 'home') return; $race = $page->meta('myrace'); $time = $page->meta('chosenat') ?: ''; if ($time) $time = date("Y-m-d H:i:s", $time); $form->insertAfter([ 'type' => 'markup', 'name' => 'mymarkup', 'value' => '<h1 class=uk-margin-remove>I am a custom markup field</h1>' . "<p>Last Chosen Race: $race (@$time)</p>", ], $form->get('title')); // data coming from your file $races = ['foo', 'bar', 'baz']; // add all options $f = new InputfieldRadios(); $f->label = 'Choose your race'; $f->name = 'myrace'; foreach ($races as $race) { $f->addOption($race, "Use Race '$race' for something"); } // now add it after our markup field: $form->insertAfter($f, $form->get('mymarkup')); }); $wire->addHookAfter("Pages::saveReady", function (HookEvent $event) { // get the selected race from the radio input // we sanitize the input to make sure it is a string $race = $this->wire->input->post('myrace', 'string'); if (!$race) return; // save selected race to page meta data $page = $event->arguments(0); $page->meta('myrace', $race); $page->meta('chosenat', time()); }); No modules, no rocket science. Just ProcessWire awesomeness 🙂
  11. Or you just use RockFrontend 😉 /* h1 fluid font size, 20px on mobile, 40px on desktop */ h1 { font-size: rfGrow(20px, 40px); } Does also work for margins, paddings, translate etc etc...
  12. This is where you make it more complicated than it needs to be 😉 You don't need to cancel the save at any stage. You just need to make sure that only the correct values are written to a dedicated field of your page. But there's nothing bad in having the file stored in one field, then process that file on save, then let the user choose the correct race and then on the next save you write the correct race to the dedicated field that only stores one race. This would be fairly easy to achieve with a custom markup field. There you process the file and display results, for example with a radio list element. The markup field could show some information like "this field will list all races from the uploaded file. please upload a file and save the page." After upload and save you present something like this: Once the user selects for example "race 2" and saves the page you take that information and save all the necessary data of race 2 to your page's dedicated fields and voila you always have the correct data in your pages and you don't need to revert anything or such. In general chances are high that this feeling is wrong 😄
  13. There are no modules for that as far as I know. What you are looking for is not so easy. ProcessWire does that by redirecting to a dedicated form that is only built for that very specific action and takes all the arguments via GET parameters: That way PW knows what to do after the confirmation was given. In that case it will remove field 102 from template 1. You see that very basic behaviour and its limitations if you try to remove fields and also try to rename the template. Then PW needs to show to confirmations and do two actions and just skips one with informing the user: That's some background to what you were asking. If you tell us more about your real use case it would be easier to think of the best solution. Details really matter here. Which fields do you want to check? Are we talking about 2? 10? 100? Can we simply wipe data if some conditions are not met and show a warning or do we need to restore old values or such?
  14. Do you really think this could be an issue? I can't tell how that behaves on huge installations but on mine I've quickly tested this and I think looping over all links should be fine: It takes 225ms for 469 pages, so if there are only a handful in a body field I don't think that it would matter?
  15. Yeah I'm indeed not using that often, but once in a while it comes in handy. What about adding a warning to db() and bdb() calls? This is the markup I used: <svg title="Warning: Dumping large objects might slow down your browser! Use d() or bd() instead." uk-tooltip style="color: orange; margin-right: 5px;" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" aria-expanded="false" tabindex="0"><g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"></path><path fill="currentColor" d="M11.99 1.968c1.023 0 1.97.521 2.512 1.359l.103.172l7.1 12.25l.062.126a3 3 0 0 1-2.568 4.117L19 20H5l-.049-.003l-.112.002a3 3 0 0 1-2.268-1.226l-.109-.16a3 3 0 0 1-.32-2.545l.072-.194l.06-.125L9.366 3.516a3 3 0 0 1 2.625-1.548zM12.01 14l-.127.007a1 1 0 0 0 0 1.986L12 16l.127-.007a1 1 0 0 0 0-1.986L12.01 14zM12 8a1 1 0 0 0-.993.883L11 9v2l.007.117a1 1 0 0 0 1.986 0L13 11V9l-.007-.117A1 1 0 0 0 12 8z"></path></g></svg> It might help others as well that are not aware of this issue.
  16. Yeah, just wanted to edit my post to state that I might need to change my habits here 🙂 I'm always using db because it's annoying to not get the full result. Didn't realise that it has that side effect. Awesome. All the settings to fix this issue are already there 🙂 Limiting the number to 20 and nesting to 3 for example makes everything stay snappy. Great! Thx for your quick help.
  17. I think I found the issue! The issue occurs if you dump a large dataset! I had some code to test the performance of a $pages->find("something") call... For that I first loaded all pages via $all = $pages->find("include=all") and dumped it via db($all) which showed the following: This was enough to make the whole page really laggy. Even when hovering the debug bar it took quite long for the pop-ups to appear. After a reload everything was snappy, so the issue occurred only after I executed the console code at least once. Seems that the dump adds so many elements to the dom that the browser can't really handle it! Not sure what we could do about this? I'm using default values for dumping:
  18. I've even had a look at the module settings!! Didn't spot it there as well - thx a lot 🙂 We'll see if that makes a noticeable difference.
  19. Hey @adrian I'm still having this issue. Can I somehow disable the autocomplete feature of the ACE editor? That would be my first guess and it's really not useful to me anyhow. I tried to find it in the code but didn't 🙂
  20. Idea: What about a shift-click feature that immediately translates the default language to the language that was clicked. We would then have the benefit of one-click translation by maintaining the benefit of instantly seeing the result.
  21. Hey @FireWire me again 🙂 What is really annoying in the translation process is when the content contains links. Unfortunately deepl can't link know about the different urls for pages in different languages. I don't have very much experience with multilingual sites yet, so I might be missing something? But for now the process for me is: Write text in german. Click on English tab. Hit translate. Fix all links that are still pointing to german urls. The annoying part here is that if I fix a typo or change one sentence I can't just hit "translate to english" because that will wipe my links as well. So I have to either translate that sentence manually or fix all links. This is not just annoying but also prone to errors. I thought maybe it would be possible to check for links in the returned result (eg via Regex or maybe even better via dom parsing) and then loop those links and automatically link them to the english version if one exists and is active. I think that should work well and I'd be happy to sponsor this addition if you help me with pointers on how the module actually works and where the translation takes place. Maybe we could even make the request that fetches data from deepl hookable so that anything would be possible and so that this feature of automatically converting links could be enabled or disabled via a checkbox in the settings.
  22. Thx @imandreas the docs are restored here: https://www.baumrock.com/en/processwire/modules/rockfrontend/docs/
  23. Ich möchte anmerken, dass ich NICHT eingeladen habe, hier auf Deutsch zu schreiben, denn das widerspricht den Forums-Regeln. Ich habe angemerkt, dass DeepL sehr gut im Übersetzen ist und eine gute Möglichkeit sein kann, wenn man Probleme mit Englisch hat. Die Idee war aber, den Post auf Deutsch zu verfassen, dann mit DeepL zu übersetzen und dann auf Englisch hier zu posten. I would like to note that I did NOT invite people to write in German here, because that is against the forum rules. I noted that DeepL is very good at translating and can be a good option if you have problems with English. But the idea was to write the post in German, then translate it with DeepL and then post it here in English. CAUTION: This script is likely NOT doing what you want. The selector selects the "authlogs" page, which is the parent page! You want to delete "authlog" pages. CAUTION2: If you change the selector from "authlogs" to "authlog" then it will delete ALL authlog pages, not only old ones. You'll probably want something like this: <?php $cutoff = strtotime("2023-09-01"); $pages->find("template=authlog, your_date_field < $cutoff"); PS: Considering that the selector was wrong that would also explain why it didn't change the page count: You tried to delete the parent page, which is not possible unless you delete all children first. So the script actually did nothing and the count didn't change.
  24. Hey Frank, you are very vague with your information that you give us. Therefore it's not easy to help. If english is a problem for you just write your question in german on deepl.com/translator and copy paste the english version here. Which table? A database table? Or PW pages? Where is your date stored? In a regular PW field? Then it would be a simple $pages->find("your_date_field<..."); But we don't know anything about your setup, so nobody can really help.
  25. You can use TextformatterRockDown for that. You can any custom tags you like.
×
×
  • Create New...