Jump to content

Jonathan Lahijani

Members
  • Posts

    802
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jonathan Lahijani

  1. MariaDB won't be an issue. I'm running ProcessWire on it with quite a few sites, from simple to complex, without any issues. (fun fact, Craft CMS requires MySQL or PostgreSQL; MariaDB won't work) I don't have direct experience with setting up Litespeed but that shouldn't be an issue either. I think Geffen Playhouse (a site I developed) is on Litespeed. The hosting company has abstracted that away and Litespeed is built as a drop-in replacement (?) for Apache so I wouldn't worry about that either. As @da² mentioned, if you use Windows, WSL is an excellent and seamless choice to spin up a VM to test, or DigitalOcean or Hetzner if you don't want to install a VM hypervisor on your system. Either way, you'll have to set up the server software and configure it yourself. I recommend Ubuntu 24.04 and installing everything with apt. If using VS Code, you can connect to the server and modify files as if it were a local VM site using VS Code Remote SSH.
  2. I recently discovered Pinkary.com which I would describe as a Twitter clone, built by one of the Laravel team members with all the latest and greatest of Laravel and its ecosystem (the project is open-source). Right now it's got about 1000 members after being launched earlier this year and it's almost all web developers, which reminds me of the early Twitter days. I don't get excited about social media or microblogging much, but having a concentrated community of like-minded folks is intriguing and a place to find interesting things going on and nuggets of information, without all the noise, bots and other nonsense you'd see on Twitter/X. I think it's worth a join.
  3. Thanks for the replies. I agree that using the page name has a bit of an "ick" factor, but the name won't change and I can lock the field regardless. I am purposely trying not to create a new specific template for each company, and although that approach is probably more clean and direct, it messes with the following extra part... I didn't mention in my example that there is also a "Company Types" field where a company can have multiple selections of the following: Provider Fulfiller Biller If the company is a "Provider", then I want the tools method (I've already programmed this but left it out in my example code to keep things simple). Although that could lead to some issues if I tried accessing that method and it's not available unless I did some extra checks, but that's not totally clean as well.
  4. Let's say I have the following pages with these names that use the "company" template: microsoft apple google Let's say my page class has a method called 'foo'. I want the code that's run to be dependent on the page name, but I don't want to do it like this: public function foo() { if($this->name=="microsoft") { // code for microsoft } elseif($this->name=="apple") { // code for apple } elseif($this->name=="google") { // code for google } } Instead, I want each company to have their own class (but keep the pages as 'company' class -- don't touch!) with each method implemented within that class. How would you go about this? I solved this by adding a property to the Page class using property hooks which has access to the respective method (what's this technique called? is there a name for it?), but wondering if there's a better way: class MicrosoftCompanyTools { public function foo() { echo "test"; } } wire()->addHookProperty('CompanyPage::tools', function($event) { $company = $event->object; $companyClassName = "ProcessWire\\" . ucfirst(str_replace('-', '', $company->name))."CompanyTools"; if(!class_exists($companyClassName)) $event->return = false; $event->return = new $companyClassName(); }); // example call $pages->get('template=company,name=microsoft')->tools->foo();
  5. When creating a single page select, I use "Single page Page or boolean false when none selected" value type. It's become a habit that I haven't given it much thought about until recently. I believe this was the default option in PW at some point from the beginning (?), or at least because it shows higher up than the other option, I've tended to use it more. Then when there was an update to ProcessWire a couple years that brought in field setups, if you create a field using the "Singe page: select" setup, it defaults to using the "Single page Page or empty page NullPage when none selected" value type. When I create a field this way, I change it back to "Single page Page or boolean false when none selected" however it makes me wonder if using NullPage as opposed to a boolean is a better practice. This matters because when detecting false vs. NullPage the code must be modified to work correctly. This will bug if the there is no assigned page and the return type is boolean false: // Warning: Attempt to read property "id" on false if($page->my_single_page_reference_field->id) {} Furthermore, if you're not careful with whether you do ->id vs. the value type, your true/false could be swapped. Ack! What is your preference and why? I think mine would be to get a NullPage instead of false if there is no page.
  6. Probably, but also keep in mind the styling of the event displayed in the day box is very custom as well: https://www.geffenplayhouse.org/tickets/#cal
  7. No need for multi-day events, so that wasn't even something I thought about. That's actually something I would imagine would make the CSS Grid approach potentially unusable if you need to span the event over multiple days, but at the same time support for spanning was one thing that made FullCalendar difficult to style for my simple needs, at least in v3. As for display order/stacking, that was another issue that I had to hack around with FullCalendar. For example, if Geffen had a day with an events schedule like this (ordered by time): Show A: 2:00pm Show B: 3:00pm Show A: 4:00pm Show B: 5:00pm They would actually want it to be displayed like this (ie, grouped by show, then time): Show A: 2:00 pm 4:00 pm Show B: 3:00 pm 5:00 pm That's not the "natural" way it would work in a pure calendar sense (which orders strictly by time), so with FullCalendar I had to basically do-away with how it normally puts in an event and inject custom HTML, which kind of defeats the purpose of using a calendar library. I believe when they switched from v3 to v4, they changed too much of how it worked internally and I didn't want to redo that work-around to be compatible with v4, so that's when I gave the whole approach a re-think (we launched in 2019 with FullCalendar, then I re-did it in HTMX in 2022).
  8. I can give a quick reply about the Geffen calendar, but most of what there is to know about it is in that article I wrote. How the show performances (events) came to exist wasn't a concern as that was managed with a 3rd party service, obtained via an API and stored as child pages of a show. The main takeaway from that project was that we needed to simply display upcoming shows in a monthly calendar format (large and small) and when I originally developed the site, I leaned on FullCalendar. However that was total overkill and difficult to maintain because FullCalendar is more than just a way to display events in a calendar format, but an interactive component with dragging and dropping like what you'd get in a real calendaring system (Google Calendar, etc.). It's also built with complex JS which I like to avoid. I just needed an easy way to display information with simple AJAX loading between months. To solve those, CSS Grid (ie, "display:grid") and HTMX fit perfectly with some straight-forward PHP code to build it. One extra improvement that can be made to display a large and small calendar in different contexts while using the same HTML is to use container queries, but because browser support for it a couple years ago was still very low, I avoided it.
  9. Wasn't there a module that surfaced this information in the admin? Anyone remember what it was called? I can't find it. Edit: TracyDebugger can do it.
  10. Very true. IP block lists, mail limits and all that stuff is probably something I don't want to deal with on my own, but I'll probably experiment with it on a personal sites just to get an understanding.
  11. A couple others I forgot to mention originally: Matomo: website analytics (alternative to Google Analytics) https://matomo.org/ Syncthing: file syncing tool (alternative to Dropbox, Google Drive); it's not strictly a tool to help build websites like all the others I mentioned, but it's become a vital tool in helping me de-google https://syncthing.net/
  12. I haven't used it yet but it would be for both transactional emails and mass emails (newsletters). In the context of ProcessWire: transactional emails being Form Builder email notifications, forgot password requests, new user notifications, etc. mass emails being those sent by ProMailer
  13. I'd like to hear what software you self-host and that act as an alternative for a cloud-based offering. It doesn't have to be FOSS, commercial is OK too. Some of my go-to ones, beyond ProcessWire and LAMP, are: Uptime Kuma: an uptime monitor (recently discovered this and it's earned a spot on my 'tools' server) https://github.com/louislam/uptime-kuma Postal: open-source mail delivery platform (recently discovered this as well; acts as an alternative to Mailgun, Sendgrid). https://docs.postalserver.io/ Invoice Ninja: I already have my own custom project/bookkeeping/invoices system that I built and maintain with PW, but I'd probably use this if I didn't go that route https://www.invoiceninja.org/ RocketShipIt: self hosted shipping API (has a cloud option as well; commercial but very good pricing; alternative to EasyPost and similar services) https://www.rocketship.it/
  14. At the time of this writing: Ubuntu 22.04 is at Apache 2.4.52 Ubuntu 24.04 is at Apache 2.4.58 Both are experiencing the issue where going to example.com/some-folder/?foo=%3Fbar causes a 403, unless I modify the rewrite rule to be this updated version discussed above: RewriteRule ^(.*)$ index.php [L,QSA] @adrian You said the issue would be resolved when 2.4.63 is available. So is the best plan to wait for that version to be released in apt package manager, update to it, then revert the rewrite rule back to what it originally was?
  15. What was described in the tweet sounds somewhat similar to what I did with Transferware Collectors Club, which I built over the course of 2021 and with HTMX (before it was 1.0). Check out the video I linked to in the post here (it's not a public site):
  16. I just set up Uptime Kuma based on the recommendation here. It's a nice piece of software. I set it up on a very cheap Hetzner server (like $3.85/month) and installed it using the non-Docker approach. I'm using Mailgun for email notifications. It's my first time using Hetzner but I keep hearing great things about it. DigitalOcean is my go-to for servers, but Hetzner has better deals apparently. Feature rich, self-hosted, easy to install (ie, it didn't break when following the simple commands). Perfection.
  17. @bernhard Can pw:install be completely unattended if I execute it with all the required options on the command line (which I'm guessing is not possible for database info) or does it require "stepping" through given that it's built with BrowserKit? Note: I'm not using ddev if that matters.
  18. To answer my own question, part of it has to do with the order of operation stuff we discussed here: https://github.com/baumrock/RockMigrations/issues/23
  19. Hi Bernard, In Rails, it's theoretically possible to take a non-Rails managed database and get the schema of it in ActiveRecord-based migrations: db:schema:dump The reason I bring this up is because if I wanted to take an existing non-RM PW project and start using RM in its entirety, I believe I currently have to manually make the master migrations file initially "by hand" even if it involves copying the field or template export code (let's not forget pages as well) RM conveniently provides when editing a field or template. So my question is, does RM have an equivalent of Rails' schema dump to speed up completely RM-ifying an existing project or would I have to manually create those field and template migrations (and pages as well)? I could do it by hand (no problem) and it would take 1-2 hours. This question also touches up tearing up and down a site for testing. Interested to hear your thoughts.
  20. @adrian No issues with latest version.
  21. Another question: In Mystique, you are able to detect the page requesting the field, and as a result, modify the fields that actually get displayed. This is very useful because it allows you to have one Mystique field but have it "morph" depending on the context. On my sites, I typically only have 1 Mystique field called 'options'. I then assign that to various templates that need it (even specific matrix-types like for my page builder). Then when the field is loaded when editing a page or a matrix-type, I can "build" the field based on what template requested it because the $page variable is available. My 'gallery' matrix-type/page builder block will have fields that are gallery configuration related, my 'video' block will have video configuration fields, but they are all still technically the single Mystique 'options' field. @ryan So in your example of /site/templates/custom-fields/contact.php, is it able to determine what page requested it?
  22. As others have mentioned, this is quite similar to the Mystique field which I'm a fan of and has the feel of how custom fields work in WordPress (more "on the fly"). I use Mystique for my matrix-based page builder block options which is a great fit. Will consider switching to this since it will be first-party and more integrated. Does it store the saved input data in json as well? I'm guessing this doesn't work with repeaters or images, correct?
  23. @ryan In my original reply to this post I mentioned making PW a bit stronger for web application development. After reading these replies, it seems that a lot of the more intricate techniques that would be desired for advanced use cases are already possible natively, but even those of us here that I would consider highly experienced with PW and OOP are still picking up a few crucial nuggets of information that go a long way in structuring a web application with PW (at least it seems that way). So to elaborate on what I stated originally, I think demonstrating how you would approach some of these advanced techniques natively in PW (showing that a feature request to make it "nicer" is not necessary / technically problematic) in a real working app would be very helpful. I believe you attempted this with the site-invoices profile and building it out further with more web-application-y type techniques would really be great.
  24. @ryan Assuming one were to take this approach, what is the proper/recommended way to load the ProductPageTools.php class file?
  25. With regards to SEO related features, I think that being natively built in to ProcessWire is not the best choice as it goes against the unopinionated nature of ProcessWire. If one were to develop a webapp where SEO is not necessary, those fields would cause bloat. But if this were to be an official Profield, it would be wonderful. Personally, I use the FieldsetGroup Pro field (I gave SEOMaestro a try but it didn't work the way I liked), but since that's now legacy, I will have to switch my approach at some point in the future. It looks like this (note: it used to have XML sitemap fields as well, however when WireSitemapXML came out, I removed them and let that module handle it): If there were to be an new SEO module similar to my screenshot (meaning it supports fields for X, Facebook and other social networks), I would hope it's not officially called "FieldtypeSEO" but rather something like "FieldtypePresence" (ChatGPT helped me with that one) since it's more fitting (it helps improve your site's "presence" via search engines and social media networks). Personally I dislike the word SEO as it represents a lot of what's wrong with the internet and the snake-oil behind it.
×
×
  • Create New...