Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/09/2025 in all areas

  1. @HerTha PHP 8 made working with string functions a little more strict, but a quick fix is possible. Try using a null coalescing operator to tidy things up. <?php // Checks if a non-null value exists for a variable, if it does then it will be passed to trim(), if it doesn't or it has a null value, will fall back to an empty string. trim($someVar ?? ''); // This should work with preg_replace() as well, or any function that expects a string but may not receive one preg_replace('/someregexstuff/', 'Replacement', $someVar ?? ''); Hope that helps out!
    1 point
  2. Yes, it does. As others have pointed out: if you only want to index a single page, indexPage($page) is the correct method β€” but I also have no idea what the purpose of that would be. My guess is that it was either added due to some kind of misunderstanding, or perhaps you indeed did want to recreate the full index every time a page is saved. If it was the latter reason then that might make some sense, but it is also a very bad idea in terms of performance (as you've noted here) πŸ™‚
    1 point
  3. I'm loving config migrations more and more πŸ₯° They reduce complexity and increase stability and performance. Win-Win! Wherever you want. Nothing changed here. You can put it in /site/migrate.php, you can put it in your /site/modules/Site/Site.module.php module's migrate() method, etc... I have to correct myself here @Jonathan Lahijani Today I had to create the following page reference field: <?php return [ 'type' => 'page', 'parent_id' => '/tags/', // ... ]; The "parent_id" setting caused a problem, because the /tags page did not exist when this was run, so the migration failed. I went ahead and implemented a way to properly, reliably and easily create new pages with your config migrations: MAY I INTRODUCE: Config Migration Hooks 😍 😎 πŸš€ Please check out the dedicated docs page, which are at the moment only on the dev branch and will soon be merged to main and then be also available on my website: https://github.com/baumrock/RockMigrations/tree/dev/docs/config-migrations-hooks
    1 point
  4. As of today we count 951 stars on Github. Would be great to hit 1k by the end of this year! I'll suggest we all invite our PW-friends to star the repo if they haven't done yet! My next newsletter will be in 2025, but I'll add it there as well. Also @teppo you might want to mention this in your newsletter which would have a lot more impact than mine I guess πŸ˜„
    1 point
  5. @artfulrobot @ryan - I wonder if some of the new techniques described here would help?
    1 point
Γ—
Γ—
  • Create New...