Jump to content

bernhard

Members
  • Posts

    5,722
  • Joined

  • Last visited

  • Days Won

    271

Everything posted by bernhard

  1. Good points! Htacces changes are very rare anyhow, so that would be totally fine. I'll think of that option in the future ?
  2. Hi Horst, I'm late on that one, thx for all your work! ? $image = $page->images->first()->size(300, 300); ?> <picture> <?php if($image->hasWebp) { ?> <source srcset="<?=$image->srcWebp?>" type="image/webp" /> <?php } ?> <source srcset="<?=$image->src?>" type="image/jpeg" /> <img src="<?=$image->url?>" alt="Alt Text!" /> </picture> What about something like this to ? $image = $page->images->first()->size(300, 300); echo $image->hasWebp( "<source srcset='{srcWebp}' type='image/webp'/>", "<source srcset='{src}' type='image/jpeg'/><img src='{url}' alt='{description}'/>" ); Such a method could even be extended with custom templates set via $config->webp or the like and could also get a third argument for options. Then the example above could be: echo $page->images->first()->size(300, 300)->hasWebp(); ...and produce the exact same output as your example. Maybe $img->webp(...) would be a better name for such a method than $img->hasWebp(...)
  3. Because the projects I did lately didn't need forms or needed some more complex ones and I used FormBuilder for that. I find nette forms a little complicated to understand and modify. The PW forms api is a lot cleaner (at least to me, being familiar with PW). Other solutions are: Custom HTML/PHP Forms Forms API FormBuilder (commercial module)
  4. Hey everybody, thx for all your great input! ? After trying lots of different things, watching lots of youtube videos and reading lots of tutorials and docs I'm one step further (or not ? )... I've tried devilbox, I've installed ubuntu on my laptop, I've tried nomachine, I have -not- tried https://remmina.org yet (got that hint yesterday from @Christophe ), I've forgotten what else I've tried ? Somehow I'm going in circles... Everything has its pro's and con's... Ubuntu (18.04) Really nice experience! VSCode works perfectly and development would be on a linux machine. I'd also learn more about linux, which would always be a good idea. The problem is that I'd then need to maintain 6 environments instead of 3 (3xWin10, 3xUbuntu). Maybe I could do a mix. A friend mentioned https://www.ansible.com/ - but I guess that makes things just even more complicated. I guess some manual work will always be necessary to some extent. Another problem using Ubuntu is the server setup... how to handle different vhosts, different projects, different php versions? Devilbox Devilbox should solve that problem. It should also work on all platforms that support docker. But it is quite complicated to setup (compared to laragon, that will even run on a USB drive) and it's quite slow on windows. Apart from that it looks great, especially on ubuntu, so I'll give it a chance! Nomachine This is a remote desktop like teamviewer. The connection via SSH is not available in the free version. The screen was recognizably pixelated (the one you know from high jpg compression), so I guess this would not be fun to work with. I've given up this idea of remote editing from one single computer. So after all I get the feeling that the best experience will be to have a local dev environment. Whatever that might be... Another problem is that if you are working in a team environments WILL be different. So devilbox could help in such a scenario, while a single specialized dev-vps that is highly customized for my needs would not help at all. Yeah. Tried docker now and it looks quite nice. Still a little complicated for me, but devilbox builds on docker + docker-compose and I totally get why it is so popular ? Yeah. All those things always sound great at the beginning but then there is some point where you start hitting walls. I was using the portable version for some time, but then It was not integrated in the context menu (I use "open in vscode" quite often) and some other parts where also not perfect (no auto updates, etc... things that you don't realize first but that start getting annoying lateron). Interesting. Maybe Ubuntu was the problem. Or the cloud server setup. Who knows ? Also very interesting, thx! But does "Find in Folder..." work on that setup? And what about the fuzzy file search (ctrl + P, then type "wir arr")? Does it work? Is it performant? Can't believe that those things are nearly as performant as on a local machine... I have some ssh plugins installed. They are good for some special tasks but not more than that. It's not a replacement for a local dev setup. I use one to quickly edit files online (that's great if you need it, just browse the file tree as if it where on your pc, open the file, save it, done) and one to connect to my servers via ssh in the integrated terminal (ctrl + shift + p, type "sshlogin", choose the server and you are logged in).
  5. Thx. Didn't know about that. But I guess I'd then need to copy the whole .htaccess content over? Or does it load .htaccess additionally? Before or after the .htaccess? Or can that be defined?
  6. Update on the intelephense issue of core modules: https://github.com/processwire/processwire-issues/issues/860 The mentioned quickfix is to copy all .module files in a temp/hidden directory, eg /site/assets/.intelephense and add the .php file ending. It works: In my installation I have 139 .module files - quite a lot that is not indexed by Intelephense! Moving those files to a new folder when anything has changed would be quite easy. Intelephense would always be up to date with the current install (there could be custom modules in /site/modules as you can see in the screenshot). A custom module for this would be too much, I guess. I think that would fit great into @adrian 's TracyDebugger. What do you (and others) think? In the meantime I've filed an issue in their repo, you might give me support there: https://github.com/bmewburn/vscode-intelephense/issues/454
  7. Hi everybody ? Just realized that redirecting to HTTPS does not work when ProCache is enabled (of course it does not work, but I didn't think of it...). The problem with redirecting via the default .htaccess rule is that it will also redirect to https on your dev environment. But you can easily exclude any domains from this redirect rule like this: # ----------------------------------------------------------------------------------------------- # 9. If you only want to allow HTTPS, uncomment the RewriteCond and RewriteRule lines below. # ----------------------------------------------------------------------------------------------- RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !.*\.test$ [NC] RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Maybe that helps someone else as well.
  8. Thx. That seems to solve the intellisense issue, but really like VSCode and want to use it for my everyday work ? Thx Francis, both solutions do only solve one problem (but not all). I have a settings sync extension in place, but it does not work perfectly. I also need to install VSCode on all machines and - that's the worst part - need to copy over all files+DB before I can switch the machine. I need to make sure that all installations are the same (same php versions, same php path etc). It works. It's my current setup. But it sucks ? I have no experience with docker, but wouldn't that have similar problems and just solve the problem of having different setups? I'd still need to setup all my VSCode instances, php executable paths, install composer, npm etc....
  9. Maybe you want to give (Rock)Migrations a try ? I usually just do a git pull (and modules refresh) and that's it. But as I said (or tried to), that's not the problem. The problem is that I have 3 machines that I want to use for development and all should have the same experience with no effort. That could work when the environment is centralized. But maybe I want too much...
  10. Sorry for hijacking this thread, but it could also be an intersting topic for you guys as it is a different approach that we could use for our development on Windows (and I'd need help to make it work):
  11. Hello everybody! I'm trying and trying and can't seem to get this working. I've recently been evaluating different cloud providers and while playing around with all this fancy, scalable, flexible (and quite cheap!) cloud stuff I thought, "what if I created an Ubuntu dev server for all my web development?". That's nothing new, you might think, and you are partly right, because that's what we are all doing with our live servers. BUT: I wanted to access the whole dev server remotely with a GUI, so that I can install and use VSCode directly on the server. That would have major benefits to my current setup (local Win10 laragon + VSCode). The pains: I have to keep VSCode in sync between different machines (Desktop, Laptop, weekend home) I need to take care of backups When I share work with clients my PC has to be turned on (ngrok) It's a windows system and not always behaving same as my linux live server Slooooooow internet connection at my weekend home in the mountains... That would all be solved if I could move my dev environment to the cloud. Of course, I'd need an internet connection (so it wouldn't work that great in a train/airplane), but that's fine I guess. Currently I'm using a VSCode extension to map remote file systems via SSH into the IDE. That works great for little edits, but it has three major drawbacks: I still need to keep different VSCode installations in sync (themes, settings, extensions, php path variables etc... you know all that) I don't have a "search in files" feature, which is VERY important for my work I don't have code intellisense available for the project, which is also very important That's why I thought: Why not use something like a remote desktop, install a desktop on the Ubuntu server and use it from wherever I want, always with my common settings and highspeed internet. I failed ? I'm not good at linux, so maybe it was my fault, but I could not get a remote connection working properly via xrdp/rdp. Via teamviewer I got only 800x600 screen resolution (was not able to change that) and the commercial license is too expensive. Also VNC did not seem to be a good option (didn't try that, though). Then a friend of mine mentioned X11-forwarding and a tool called MobaXterm. It's a tool where you can forward the program's execution from the host via SSH and display the GUI on the client. Awesome. Exactly what I'd need. Have a look at MobaXterm, it seems to be a great alternative to WinSCP or Putty or FileZilla. I managed to run the xclock program of the Ubuntu 18.04 host server on my Win10 client. Very nice! But unfortunately I couldn't get vscode to run ? error while loading shared libraries: libXtst.so.6: cannot open shared object file: No such file or directory I have no idea what that means. It seems that the X11 server I'm using on Windows does not work for vscode. I found this issue: https://github.com/Microsoft/vscode/issues/65232 where byates says: So it seems to be possible. Some comments seem to confirm that. But I don't know how to use MobaXterm with VcXsrc and I can't comment the issue on Github to get some help of those users ? Maybe some linux gurus here can help me with this problem? Maybe someone likes the idea of having a remove coding environment (also found https://coder.com/ ) and wants to try this himself? Especially the VSCode Users on Windows? @kongondo Thank you! PS: This video shows what I'm talking about (using Putty: https://www.youtube.com/watch?v=NNuXpk10zXE )
  12. Just found another nice tool for debugging rest apis: https://insomnia.rest/
  13. Hm... Thinking a little more about it, I think having a setting "set checkbox to true by default for newly created pages" would be the best option. Changing the default setting during lifetime of your website is unlikely and if so, this setting would just impact newly created pages and there would not be the need for updating existing pages (as they already have the correct value, which was set manually at that time). It would be a very easy hook, as shown above: https://processwire.com/talk/topic/2199-checkbox-default-value/?tab=comments#comment-184564 Sorry for hijacking your thread robin and thanks for the discussion ?
  14. Thx Robin! ? @Gadgetto this might also be interesting for you. I still think having the value reversed and naming the field not_whatsoever is not the best solution (please don't take this as criticism!). Couldn't we create a new Fieldtype "CheckboxDefaultTrue" that extends the I've played around with this idea and I got this "far" ? <?php namespace ProcessWire; /** * ProcessWire Checkbox Fieldtype * * This Fieldtype stores an ON/OFF toggle via a single checkbox. The ON value is 1 and OFF value is 0. * * For documentation about the fields used in this class, please see: * /wire/core/Fieldtype.php * * ProcessWire 3.x, Copyright 2016 by Ryan Cramer * https://processwire.com * */ class FieldtypeCheckboxTrue extends FieldtypeCheckbox { public static function getModuleInfo() { return array( 'title' => 'CheckboxTrue', 'version' => 101, 'summary' => 'Same as core checkbox but defaults to true', ); } public function getBlankValue(Page $page, Field $field) { return 1; } public function sanitizeValue(Page $page, Field $field, $value) { return $value ? 1 : 0; } public function getMatchQuery($query, $table, $subfield, $operator, $value) { // need help here :) } } This seems to work, but I'd need help with the getMatchQuery. This way the checkbox stores "0" for every unchecked checkbox and NULL for every checked checkbox (which is the default): What do you think?
  15. Yeah, that's why I disabled it lately ? I think it also broke something else (ajax etc. getting more complicated when things are hidden at first...). But if done right, maybe it could improve the usability. Not sure ?
  16. Are you talking about effects like the one above? I've once created a little module that shows a "loading" overlay animation until the page is fully loaded. Would that also be an option or are you talking about something else? Sorry, I'm not good at frontend stuff ?
  17. I have not used Padloper yet, but I built a custom shop lately and it's a LOT of work ? The problem is not the payment integration, the problem is handling all the user interactions (shopping cart, taxes, product variations etc). So it depends a lot on your scenario. If you only want to collect donations without any other features, then you might not need padloper (but then you could also just use a payment button from one of the providers)
  18. Or just use $this->log('foo bar'); https://processwire.com/blog/posts/processwire-core-updates-2.5.15/#new-log-and-this-gt-log-text-api-functions
  19. Hey Robin, I wonder what you think about this approach: This could also be packed in a module and I think the behaviour is a little bit easier to understand (checked is checked ? ). Maybe you tried something similar and found some drawbacks with this simple approach?
  20. What about this? $wire->addHookAfter("Pages::added", function($event) { $page = $event->arguments(0); // check for page template if necessary here $page->setAndSave('check', 1); }); PS: Did you see @Robin S module?
  21. https://github.com/adrianbj/TracyDebugger/blob/master/TracyDebugger.module.php#L2736 Learn from the best ??
  22. Maybe, but maybe not. It would be an easy fix on the PW side and maybe a not-so-easy fix for Intelephense. It should not have any drawbacks and maybe has other benefits as well (like correct syntax highlighting by default, especially if the editor does not support file extension mappings). It seems that newer modules are already using .module.php so it would just be consistent to always use .module.php ?
  23. ?? I'll file an issue on github. Let's see what ryan thinks of renaming all those files to module.php https://github.com/processwire/processwire-issues/issues/860
×
×
  • Create New...