Jump to content

bernhard

Members
  • Posts

    6,264
  • Joined

  • Last visited

  • Days Won

    313

Everything posted by bernhard

  1. Yeah, I wanted to save that "unnecessary" step and wanted to make sure I'm not missing anything, but it's fine. Thx for your answers ?
  2. Hey @Robin S very cool! Thank you ? I'm wondering how you guys are using this information and why? As you have built a module for it there seems to be a need for it, right? I've always found that interesting to see, especially when I had to deploy something to a live system and wanted to see if there are any active users that might get kicked out by the deployment. But maybe there's more to it? Can that information be helpful in other situations as well? Thx ?
  3. Are you talking about a wrapping <p>content</p> or are you talking about a trailing paragraph: ... content ... <p>&nbsp;</p> ?
  4. Thx! Not exactly ? I just want to create a screenshot and then paste that quickly to my blog. But I want to paste it into an Images field rather then to a WYSIWYG field, because there I have more control over what happens on rendering (eg automatically resize and style it and link the high-res version as a lightbox).
  5. Yeah, that should also be no problem. It just makes things more complicated and takes longer to develop. But if anybody has a need for something I'm happy to accept PRs or custom support requests. Sure! I added a comment to make that more obvious:
  6. For my personal website I need to add many screenshots. I'd like to just save them to the clipboard and add them to my site by pasting it from the clipboard. I know that this is possible in CKE and I guess also in TinyMCE but I want to upload these images directly to an images field. Is that possible? I thought I've seen something like this once, but I couldn't find anything. Also it would be nice to be able to upload images from URL. That's especially handy when migrating content from old sites to new ones. But while writing I realise that for that use case a copy paste feature would also help! Thx
  7. Sounds great. How does the placeholder look like? Or how do we define it? Do you have any helpful screenshots? ? What about GDPR? How would that work with this module? Or is that what you mean by "only load if interacted with"?
  8. Yeah, understand that. That's why RockFrontend does it only if you check a box: And I'm also using prefixes to avoid naming collisions. So for example the favicon field's name is "rockfrontend_favicon". For AdminStyleRock I decided to go a little different route. The field is automatically added to the home template, but it will be hidden unless you are a superuser and really request the field to be visible with an url parameter. The field's name is adminstylerock_adminlogo. I've just pushed that update to the AdminStyleRock dev branch that replaces the old logo-url-inputfield with a new upload field ?
  9. I'd be interested what you mean exactly by "in this way"? Can you please describe this in more detail?
  10. @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
  11. 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?! ?
  12. 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?
  13. Seems to be doable as well: https://www.youtube.com/watch?v=1o5PjuPOkgU Your project sounds interesting but challenging ?
  14. 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.
  15. 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? ?
  16. 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" }
  17. 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.
  18. 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 ?
  19. 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> ...
  20. @cb2004 any specific reasons why that was the case? ?
  21. 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.
  22. 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/
×
×
  • Create New...