Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by bernhard

  1. @Robin S just had an issue with your solution that caused some headache. The problem is that "useLanguages" only disables the language UI of the title field, but from the API it is still a multilang field. The problem here is that the field actually shows and stores values in the user's language, which can lead to serious inconsistancies: So it looks like the page's title is "ttt" but for a user with the default language it is actually "test222" I'll report back when I found a solution but just wanted to mention that here in case someone is using that snippet. https://github.com/processwire/processwire-issues/issues/1787
  2. Ok just realised that the "rockshell" alias does not work 100% rockshell db:restore -y --> it will still ask for confirmation, so the -y seems to be ignored. Any ideas why? Update: OK... it is crazy... So if that thing knows it, why didn't it make it right from the beginning?! πŸ˜„
  3. I'd be a little afraid if that all really works on all students' machines... What if the connection breaks? What if the upload does not work? What if the laptop restarts? etc.. Does that mean the exam is failed?
  4. Seems to be doable as well: https://www.youtube.com/watch?v=1o5PjuPOkgU Your project sounds interesting but challenging πŸ˜„
  5. That's always a little annoying for me as well. What if AdminStyleRock created a logo field for you and placed it on the home template? Would that be what you want? You could then also move it to your dedicated settings page.
  6. And in contrast to @flydev 's link this is really working for me πŸ˜„ Interesting stuff. Doesn't anybody want to create a Fieldtype for that? πŸ™‚
  7. I have a new favourite alias πŸ™‚ function rockshell() { ddev exec php rock "$1" } WHY? RockShell needs to be run from within the DDEV web container. So usually you'd either ssh into the container and then run "php rock ..." or you'd have to use the command "ddev exec php rock ..." With this alias all you need to do is type "rockshell ..." πŸ™‚ Or don't add any command and you'll get the list of all RockShell commands: Here are all current aliases that I use: # ddev aliases alias ddc='ddev config --php-version=8.1 --database=mariadb:10.6 --webserver-type=apache-fpm --timezone=Europe/Vienna --omit-containers=dba' alias dds='ddev ssh && alias ll="ls -alh"' #alias dd='ddev start && ddev launch && ddev auth ssh -d ~/.ssh/ddev' alias dd='colima start && ddev start && ddev launch && ddev auth ssh' alias ddm='ddev launch -m' # launch mailhog alias ddr='ddev restart' alias ddp='ddev poweroff' alias ddx='ddev xdebug on' alias ddxo='ddev xdebug off' function rockshell() { ddev exec php rock "$1" }
  8. You could add something like this to your module that shows null: if(!$event->return) bd(Debug::backtrace()); The backtrace could have some helpful information what's going on before it is null.
  9. I don't have a real solution, but I have had similar Problems when using multi-instance. I don't think it is a namespace issue. At least in my case this was not the case. In my case the problem came from including some dependencies by using "require_once". At least on my modules I was able to fix that problem by using the PW internal class loader instead of require or require_once. This tells me that PHP seems not to be able to correctly understand "require_once" when it is used from different directories. So for PHP including the same PHP class (eg /foo/wire/MyClass.php and /bar/wire/MyClass.php) looks like including two different things and therefore it will fire the include twice and not only once. This would then lead to such "is already in use" errors. In my modules that was easy to fix, but you can't easily refactor modules that are not under your control. What I'm wondering though is why it works with plain installs and does not with your real life projects. So maybe it's another issue. But maybe my observations help nonetheless πŸ™‚
  10. Template Engines have helpers for that very common use case. For example when using RockFrontend + Latte you can take your statement and simply add "n:ifcontent" to only output the whole li-tag if it contains content, meaning it will only be output if $page->title contains something: <li n:ifcontent><a href="<?= $page->httpUrl ?>"><?= $page->title ?></a></li> Additional to that you also have other helpers, like n:tag-if that refers not to the whole markup but only to the specific tag you put it on. That's very handy when rendering menus and some items should be linked and others should not be: <li n:foreach="$page->children() as $item"> <a href="..." n:tag-if="$item->viewable()"> {$item->title} </a> </li> Which will output something like this: <li><a href="...">Viewable page</a></li> <li>Non-viewable page</li> <li><a href="...">Other viewable page</a></li> ...
  11. @cb2004 any specific reasons why that was the case? πŸ™‚
  12. Hey @Roadwolf welcome to ProcessWire and thx for the nice introduction You can read this ancient interview which tells a lot about the philosophy of ProcessWire: https://codingpad.maryspad.com/2013/07/19/interview-with-ryan-cramer-processwire-cms-founder-and-lead-developer/ While I think that this statement is not 100% correct for someone that has no coding skills at all and really does not want to learn at least the very basics the last part of the quote could not be more true πŸ™‚ I'm using it since 2013 and I'm still learning a lot and it has helped me a lot to grow πŸ™‚ So if you prefer to get things done yourself over just installing plugins you don't know and understand, then PW is a great system to choose and the community is a great place to get help once you are stuck. I don't know of any module that does that already, but creating a module on your own is easier than in any other system that I know. All you need is this: <?php namespace ProcessWire; class Nft extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Nft', 'version' => '0.0.1', 'summary' => 'Create NFTs from all images on page save', 'autoload' => true, 'singular' => true, 'icon' => 'code', 'requires' => [], 'installs' => [], ]; } } That's a fully working module that you can upload to your site and install! It does not do anything yet, so we add a hook to the init() method and then add some custom methods that we need for our use case: <?php namespace ProcessWire; class Nft extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Nft', 'version' => '0.0.1', 'summary' => 'Create NFTs from all images on page save', 'autoload' => true, 'singular' => true, 'icon' => 'code', 'requires' => [], 'installs' => [], ]; } public function init() { // hook into Pages::saved and execute the callback after a page is saved $this->wire->addHookAfter("Pages::saved", $this, "createNFTs"); } public function createNFTs(HookEvent $event): void { // get the page that has been saved $page = $event->arguments(0); // early exit if page template does not match if ($page->template != "my-nft-upload-template") return; // get images uploaded to that page // we assume they have been uploaded to the "images" field // we force the images field to return images as array // see https://shorturl.at/lorTY $images = $page->get("images[]"); foreach ($images as $image) { // $image is a PageImage object $this->createNFT($image); } } public function createNFT(Pageimage $image): void { // your code to create an NFT from an uploaded image } } Just save that file as /site/modules/Nft/Nft.module.php and click "install" in the backend, that's it. Now every time you save a page with your nft template ProcessWire will do what you want for you πŸ™‚ There is a module called MatomoWire https://processwire.com/modules/matomo-wire/ but I have not used it myself. But to use matomo you just need to copy the tracking snippet to your site. GDPR makes things a little more complicated though, so I guess you'd have to add some sort of opt-out as well. My module RockFrontend will have some helpers for that soon. As others have mentioned it's possible. But I'd also not recommend it, especially not for beginners. The problem is that many 3rd party plugins will not take that scenario into account and the risk is high that something doesn't work as expected. If you need to share code across your projects just create a module for that feature and install that module on all instances. That way you don't duplicate the workload and you can still manage the important stuff in one single location, but you have the freedom to make small changes for every instance easily. But it depends... If all your sites should be an exact 1:1 copy then some kind of multisite setup could still make sense. But I'd start a single site project first to get a quick first impression of ProcessWire πŸ˜‰ Have fun.
  13. The module is ready to be used (and is already used in several sites from several devs), just the site to sell it and also docs are not yet done. I'm working hard on that front. It will be 49€ for a single site for early birds. If anyone needs a copy already just write me a PM. Or signup for Rock-Monthly to get notified when I officially release it πŸ™‚ https://www.baumrock.com/rock-monthly/
  14. I'm using Matomo now, because it was too much hassle for me to host plausible myself. I hosted it as docker app which was quite simple (only challenge being the reverse proxy setup), but the backup part was a pain. No instructions, no help, so I decided to take the short path and just add a cronjob that shuts down docker and then copies all files to a directory that get's then backed up every night from my server control panel. That was not ideal at all and the docker backup took over 30GB of data within a very short period of time on a tiny site, meaning just hosting plausible ate 70GB of my server 😞 So I decided to give Matomo another try and as it uses PHP+MySQL it fits perfectly with my server panel and all backups run without any configuration every night smoothly and efficiently. DB size is 2,5MB at the moment πŸ˜„ And you get a lot more insights with Matomo and have a lot more options. Though the dashboard is by far not so pretty...
  15. Could you be more specific please? πŸ™‚ I'll try to!
  16. I've won a ticket for the Drupal Developer Days 2023 in Vienna. If anybody is going there as well let me know!! I don't know a lot about Drupal. I've tried it in the early 2000s and never touched it since. I only know that Ryan seemed to be using it before he built ProcessWire. So my question is: What do people from the Drupal world think about ProcessWire? Or what would they think about it if they knew it? Or how do they think in general? I'm asking for totally opinionated and subjective statements. What mindset do they have? What kind of websites/webapps do they use Drupal for. I'm also asking for developers and people using Drupal (clients). What do they like Drupal for, what do they not like it for? Do we have any Drupal developers here? What is your opinion if you compare the two systems?
  17. If teppo's suggestion doesnt work it might also help if you create a new vhost at the same provider and then upload and install a fresh copy of processwire there. During installation you'll get some system checks and they might have some helpful warnings that might be the same for your other system as well.
  18. Yes, they are up to date πŸ˜„ I mean... those snippets should also still work, but it's really a pain to keep them up to date. Even for fixing typos it's a lot of work, packaging everything into the bundle, adding all files and publishing it in the store. Whereas in RockMigrations it's just a git commit.
  19. I'm using the VSCode snippets that RockMigrations comes with - you can use pw-createmodule to create a regular module and pw-processmodule to create a process module:
  20. Thx adrian, didn't know about those settings, sorry πŸ™‚
  21. Hey @kongondo thx. Not sure what you mean exactly. I already have a working solution. The key is to create the SSE stream before the session is started: https://github.com/baumrock/RockFrontend/blob/7ea19d668c5a2acc74777374b51535d42aa56381/RockFrontend.module.php#L121 That way the script from the SSE endpoint does not block the server for regular requests of the user. I agree that it sounds similar but I think it's two different things and it's good to have two different solutions for it πŸ™‚
  • Create New...