Jump to content

cwsoft

Members
  • Posts

    134
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by cwsoft

  1. Fun fact. Creating a local backup of a live Wordpress site was easier with DDEV too. MySQL and PHP versions can easily be set in .ddev/config.yml to match the LIVE versions. Adding a POST import-db hook automatically replaces the hardcoded site URLs in the database.sql dump to match the URL on my localhost when running ddev import-db —file=database.sql.
  2. @bernhard: Thanks to your forum thread, I finally did the switch from my previously used XAMPP development stack to WSL2/DDEV on my Windows 11 machine. Now I do all my Python, PHP and Node/Html projects within the Linux subsystem on Windows 11 using VS Code as my editor of choice. Only Windows Desktop C# projects (WinForms, WPF) are still done on the Windows side using Visual Studio 2022. Always wanted SSL certificates on my localhost. Installation was easy and my first project was set up within minutes by simply cloning and importing my MySQL dump into my ddev container. Thanks for the inspiration.
  3. Hi, Contao (fka TypoLight) is somewhat close to ProcessWire from the Field, Template, Page point of view. However it lacks (at least when I last revisited it) from a powerful ProcessWire like API. This and the all objects are „pages“ approach are unique to PW from my point of view. Only thing I somewhat miss in PW is a global media/assets manager, but there may be a module someday. The easy to use PW-API makes the main difference for me and is the reason I ended up using PW for my latest projects.
  4. Nice write up. Found out about Custom Page classes and Latte after I prototyped my first project with Processwire. Both items help to improve the code structure and keep everything where it belongs to. And thanks to your post, I stumbled over PageTableNext, which seems exactly what I need for another project in the pipeline. After getting used to (and remember) the excellent API and the possibilities offered by Hooks (e.g. to modify the admin page tree based on user roles), I really enjoy to create projects with Processwire so far.
  5. Sorry didn‘t get the module specific part on my iPhone display. Deleted my old message as it was out of context.
  6. You have a field on a template which shows the default text. Than on page 1 and 2 you are fine with the default text, but for page 3 you change it to whatever you want via backend admin. Hence one field with default text and one single template, which is used by three pages in my example. The default text can be overwritten on specific pages and kept unchanged on the other pages.
  7. Sorry. Just typed from my mobile out of my head to point you to a possible PHP solution using strtotime. From here one could check the PHP documentation for https://www.php.net/manual/de/function.strtotime.php, providing some examples combining different time offsets as text string.
  8. Have you tried „+ 14 days“ as second parameter? This at least works with PHP strtotime method.
  9. Why not simply adding a field with default text to the template, which you can overwrite on pages when needed. Then you just display the text of that field.
  10. I am developing on XAMPP too. Just added a little condition in my .htaccess, detecting if I am on localhost or live. When live, I redirect all request to non www with https. On localhost, I just use http. Only thing you need to remember, is that you can‘t set PW to force admin login to use https, as this would break login on localhost. Even wrote a small tutorial dealing with basic auth and https a while ago .
  11. @netcarverThanks for the link. Yes guess Database and WireRandom are both good places to learn about the code used to hash and set the user passwords in PW.
  12. Hi, can someone point me to the code base where user->pass property respective the user->save method is defined in code? I would like to study the PW password hashing and storing a bit more in detail. From what I read in the core User/Users/Page classes, the user->pass prop will be automatically hashed when the user object is saved. I would like to investigate exactly that code which fires up when saving the hashed version of the unhashed password set via the user->pass prop. Any hint or link to the relevant code base in the Github repo would be highly appreciated. Cheer
  13. I don‘t use jQuery in the frontend, unless I want/need to use a third party plugin, which uses jQuery as dependency. One of those repeating plugins I use quite often on the frontend for convenience is DataTables. Whenever I output structured data as data table on the frontend with more than 20 row (tr), I almost always make this table sortable by columns and filterable (only show matching rows) via this plugin. Simply to give the frontend user some intuitive options to quickly narrow down the relevant data. DataTables is powerful, well customizable and well tested. Of course I could implement that stuff with vanilla JS myself. However my next customer needs another feature I would need to manually add, where with DataTables I just switch of stuff I don‘t need for a specific customer via a simple config array (e.g. disable pagination, sorting, filtering, showing detail infos etc.). Same is for font awesome, CSS grids and so on. If I only need a handfull icons, I just go with png files or UTF8 code points instead of the full blown fa-suite. If I just want to collapse some paragraphs like an accordion, I normally go with some handmade vanilla TS/JS and SASS/CSS3. But if I need to spend lot‘s of time writing TS/JS for more serious work already supported by a jQuery plugin like DataTables, I don‘t spend too much time to reinvent the wheel and just go with the jQuery Plugin. Image sliders, hero headers etc. would be examples for using jQuery too. The best part of ProcessWire is, that Ryan give us all the freedom and options to use whatever we would like to use for a specific project in the Frontend with no predefined framework (like Bootstrap) one would need to use by design.
  14. @rastographicsBreaking HTML templates into blocks, sections or partial files is what Latte supports out of the bocks. Details see https://latte.nette.org/en/template-inheritance. Maybe you can a small writeup of your approach with htmx an PW once you made your way through.
  15. @rastographicsYou can find some additional infos in this post here. Meanwhile I used the 2nd approach shown in the linked tutorial with a slightly modified setup (e.g. proper namespaces, use statements, method names etc.) to implement Latte template engine in all my new projects so far. For Latte I would go with official Latte documentation linked above. In addition I would read the Custom Page Classes tutorial linked and watch Bernhards video. Then I would start off with a first project and use normal PW template files (like a controller), loading the required latte template (view) and implement my page specific methods via custom page classes. Nice part is, that you can call the specific page methods via {$page->myAwesomeMethod()} in Latte view too.
  16. Have you tried Content-Type: application/pdf (with space after colon)? Does it work with PW if you remove the .htaccess file? Have you tried different PDF and different browsers too?
  17. The line with the readfile command has three dots at the end which seems strange to me and then adds whatever is your $download variable. Have you checked that path e.g. via outputin template and checked if file is readable?
  18. @BoostGuess stability, security and privacy data protection. I don‘t like my IP send to CDN servers and for some of my customers this would be a no go at all.
  19. I do like to refine some of my code in little steps or to prompt the AI for specific questions on my own code, like I did in the past as part of a development team with my human colleagues. Thats where AI is really not so bad in my opinion, at least if you are working alone on projects and there are no human colleagues you could ask.
  20. Yepp. No big difference from copying code from Stackoverflow and executing it if you are not really understanding what it is doing or to clone and run stuff from Github repos you don‘t own or trust, or entering the NPM dependency hell for something which just pads a string with leading numbers loading other node packages to do the job for example.
  21. @da²Guess Bernhard still checks the generated code for stuff which may break things like rm -rf commands before blindly copying and pasting code to clients projects or executing it blindly on his system with root permissions 🙂
  22. Have realized my guest login via a custom HTML5 frontend-login form and the PW API $session->login() to log in the user with the provided credentials. Combined this with $session->redirect() to route to the page which requested the authorization via $input->get() param on success or back to the frontend-login page on failure. Finally I used the receipt from @bernhard above in templates/admin.php to send frontend-users identified via $user->hasRole() to the home page when they trying to enter the backend. This allowed me to restrict all or certain pages from non authorized access via a simple method implemented in the default page class. Pretty slick what can be achieved with the great PW API plus core and the power of Latte templates of course.
  23. Have reworked all my projects with Latte and CustomPage classes and the code is more clean, way easier to read and maintain and more structured now. Definitely recommend diving into Latte and CustomPage classes for new projects to anyone. Both techniques were easy to learn and paid off quite soon in my projects.
  24. Hi, yepp ChatGPT or Copilot with VSCode are great ways to refactor code or automatically add features by prompting your needs. Don‘t use StackOverflow very often these days.
×
×
  • Create New...