Jump to content

bernhard

Members
  • Posts

    6,264
  • Joined

  • Last visited

  • Days Won

    314

Everything posted by bernhard

  1. In recent versions we have $page->get("images.first") and get("images[]"): Note that getUnformatted is NOT the same as [] --> the unformatted value will hold temporary images whereas images[] will not. See https://processwire.com/talk/topic/26952-get-image-in-the-context-of-a-hook/ and https://processwire.com/talk/topic/27528-weekly-update-– 2-september-2022/
  2. Awesome, thx! I've been reading that page, but not carefully enough ?
  3. Just a quick question to make sure I'm not missing something obvious. If I had some page meta data, like $page->meta('foo', 'my foo value') and $page->meta('bar', 'my bar value') I'd expected that $page->meta() without any arguments gave me an array like this: [ 'foo' => 'my foo value', 'bar' => 'my bar value', ] But it returns an emtpy WireData WireDataDB object. Is there an easy way to get the data that I want or do I need to build my own SQL query? Thx!
  4. Great ? If you had RM < 3.0 be sure to check out this post: https://processwire.com/talk/topic/27504-rockmigrations-??-the-ultimate-automation-and-deployment-tool-for-processwire/?do=findComment&comment=230651
  5. Hi @Guy Incognito thx for the input. RockMigrations needs PHP>=8.0 and ProcessWire should warn you about that before installation: https://github.com/baumrock/RockMigrations/blob/1089f625048c4c68e883e46d1d57d7153c155bf2/RockMigrations.info.php#L14 So you did a fresh install and got an error without PW showing the requirement fails?
  6. You don't have to enable JS in PW. And you can't. ProcessWire just manages content for you and then sends data to the user's client, that is visiting your website. Usually that data is HTML markup. In that markup you can tell the browser to load or execute JavaScript. You can either use inline JavaScript like this: <script> alert('I am a JavaScript alert'); </script> That should pop up a JS alert when visiting the page that outputs that lines of html. The other option is to load an external JavaScript file, which would/should work exactly like you wrote above. I recommend to put only this into the file until that works and then proceed: alert('works'); You can use RockFrontend to use the Latte template engine. I love it. This is how it would look in your example: <a href="#"><img src="{$config->urls->templates}images/logo.svg" alt="Manage"></a> <button class="mobile-nav-toggle" aria-controls="primary-navigation" aria-expanded="false"> <img class="icon-hamburger" src="{$config->urls->templates}images/icon-hamburger.svg" alt="" aria-hidden="true"> <img class="icon-close" src="{$config->urls->templates}images/icon-close.svg" alt="" aria-hidden="true"> <span class="visually-hidden">Menu</span> <!-- screen-reader ... accessability --> </button> You could also just use PHP's short tag syntax: <a href="#"><img src="<?= $config->urls->templates ?>images/logo.svg" alt="Manage"></a>
  7. Yeah, sorry, been talking about the PW logfiles of course ? That's why I posted it in "PW general support" and not "dev talk", but I changed the post title to make it more obvious, thx! Now I understand the answer of @wbmnfktr better ? I'm not sure yet if I really like to auto-prune logs to a given size/length/age... I think I'd prefer to get an email when logs grow too much. Do you have some code to share with us?
  8. Today I've had a site with a logfile that has grown to 70MB over the years... PW is so low-maintenance that I usually just deploy and forget ? Now while having that 70MB is not really an issue - all parameters still by far in the greens - it's definitely something that could be improved. So I'm wondering: Do you do regular maintenance on your site? Or do you have a script in place that prunes logfiles? I could think of some kind of notification system that sends me an email if one of the logfiles grows over a defined filesize. Or a cronjob that automatically prunes logs to x days. What dou you think? How do you handle logs?
  9. @gornycreative the issue is already fixed on the latest dev: There has just not been a version bump since then.
  10. There are so many things that I want to show on video, but it's a lot of work ? And I'm quite busy working on another surprise ? But I'm happy when people let me know what they think would be interesting... The camera doesn't talk a lot ?
  11. Hey @gornycreative I've just pushed that do the dev branch and it will be available in the next release of RockMigrations. I have added "permissions-" and "access-" keys to the migrate() method. I have to correct myself here. Actually the default is that RM keeps existing values! That's in line with how it works in general. It only add's things or overwrites them but it does not remove anything unless you tell it to. Could you please grab the dev branch and let me know if everything works as expected? https://github.com/baumrock/RockMigrations/tree/dev
  12. Ok thx I think I get the point ? Maybe I was not seeing the problem because RockFrontend let's you split your markup in as many files as you want, which is also helpful with HTMX. In your template you could have this <div uk-grid> <div n:foreach="$page->cards() as $card"> {$rockfrontend->render('partials/card.latte', $card)} </div> </div> And in your HTMX Endpoint you could have this: <?php $wire->addHook("/cards/{id}", function($event) { $rockfrontend = $event->wire->rockfrontend; $post = $event->wire->pages->get($event->id); if($post->template != 'blogpost') throw new Wire404Exception("Invalid Page"); return $rockfrontend->render("partials/card.latte", $post); });
  13. Thx @Robin S for your snippet, it was really helpful today ? When using RockMigrations MagicPages this gets as simple as adding this to your custom page class: public function editForm($form) { $form->get('title')->useLanguages = false; }
  14. Looks like htmx has you covered ? I read the docs like you can add "hx-headers" to your <body> and you're done.
  15. I've only little experience with HTMX. Is your request for making something possible that currently is not. Or is it about making something easier? Or is it about making something more performant? I thought you can simply request the whole page and HTMX will select the correct elements to replace? If it's about performance I'm not sure if your suggestion is really a good idea. The whole page would in my case almost always be pro-cached and therefore requests would be blazing fast. If the request returned only a portion that was not cached I guess it would be a lot slower. But it's just a guess ? I'm missing the WHY - maybe you want to explain that a little more detailed so that others that are not familiar to HTMX can better understand? Maybe @Jonathan Lahijani can also explain the gymnastics that are necessary at the moment?
  16. I've recently had to switch to a new machine and it was no issue. If I remember correctly I did not sync anything. Sometimes a refresh is a good thing to throw away things that you once installed and never needed again. Things that I'm missing I will realise immediately and just reinstall. But VSCode recently introduced Profiles (https://code.visualstudio.com/docs/editor/profiles) which would do exactly what you are asking for.
  17. https://processwire.com/talk/topic/22369-hide-uneditable-pages-in-admin-treeprocesspagelist/?do=findComment&comment=221884 Is that what you are looking for?
  18. As this was the first google search result for PW get CSV I just wanted to mention that we now have $files->getCSV() https://processwire.com/api/ref/wire-file-tools/get-c-s-v/
  19. Hi @gornycreative did you read the docblock? Does that solve your need? In general RM has the convention that SET means set, which will wipe old settings. Or at least I tried to have that convention. setTemplateFields works differently and has that parameter that you are suggesting. For fields in migrate() we also have the "fields-" key (with minus sign), that makes setTemplateFields remove fields that are not listed in the array. Similar to that we could have "permissions" and "permissions-" which will in the first case add all listed permissions and in the second remove non-listed ones.
  20. I guess you are not missing anything but RockMigrations is missing the "setRolePermissions" method. I've done some aggressive cleanup when transitioning from RM1 to RM2 to make sure that RM2 does only have methods we really need to have. Could you please copy https://github.com/baumrock/RockMigrations1/blob/1ee9f9eb4afaf83529bcedf443b31dd63a5403c8/RockMigrations1.module.php#L2135-L2145 over to RockMigrations.module.php and let me know if that solves the issue?
  21. I think that is the simplest and cleanest approach. It's possible to spin up multiple databases for one project (https://stackoverflow.com/questions/49785023/how-can-i-create-and-load-a-second-database-in-ddev) but as long as you don't need to have both projects talk to each other I think having them isolated would be the way to go. Just curious: Did you also find processwire.rocks or did that not pop up in your search? Especially the video about RockFrontend could be very interesting for you. I second that recommendation. Having a css framework has helped me a lot to get things done (and work ? ). I'm a huge fan of UIkit and especially in combination with RockFrontend it's a joy to use. I'd be curious in why you switch to bootstrap @szabesz? I've been looking into Bootstrap recently as there is a lot bigger ecosystem around bootstrap. There are so many great and free templates for bootstrap, but none for uikit. Also their efforts on using css variables is very interesting! I'm just a little afraid of the switch. RockFrontend + Less + UIkit work so well and I usually have all the tools that I need and even the awesome UIkit Javascript Microframework is so nice (https://github.com/uikit/uikit-site/blob/feature/js-utils/docs/pages/javascript-utilities.md) that I'm afraid I'd be missing something on bootstrap ?
  22. I'm also using DDEV for 1,5 years now coming from Windows+Laragon and I could not be happier. Can't remember of any issues and changing PHP versions is as easy as changing the config file and doing a "ddev restart". Also it makes things possible that were not possible with Laragon, for example on one project I needed poppler-utils for generating JPG images from PDF. On the linux server this worked nicely but on Laragon not. So local development was different from the live server environment and that's not ideal. Also when working on projects in a team DDEV is great. Just share the github repo of the project including the config.yaml of DDEV and your teammate just have to do "git pull && ddev import-db -f /site... && ddev start"
  23. This is imho a great video from the creator of Alpine.js:
  24. I've only just installed it, but it's really nice to have this in my IDE rather than having to go to github. I'm just now realising how often I've done that in the past. Now I have everything I need in VSCode ?
  25. Two great news!! 1) The module directory now reads module version numbers from package.json files!! Now when using automated workflows like shown above your module's version in the modules directory will automatically be in sync with your module ? 2) Microsoft has just released the github actions extension for VSCode that helps developing and debugging github actions directly from within your IDE!! https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-github-actions
×
×
  • Create New...