-
Posts
158 -
Joined
-
Last visited
-
Days Won
6
Everything posted by poljpocket
-
And even more. This is how the page names and titles show up in the database. Looks like it is using some non-standard punycode to encode the names and this is also where everything seems to break:
-
There you go running on the same test install from above: You are on to something here.. that looks very inconsistent! Note how the page name in the log message is always correct but shows wrong in the "Settings" tab.
-
You are right, copy-pasta mistake. I just copied your stuff over. But I corrected it right now and it doesn't make a difference (and yes, it's only about the rewrite rules and doesn't affect the PW admin in any way). Maybe you will find something with the hooks I have talked about above.
-
You can maybe start by looking into where the problem occurs. You can for example use Tracy's bd() function to output the page name before and after every saveReady and saved hook. This will at least let you see in which part of the code you have to go dig for more. Do you have any hooks already in use for Page::saveReady and Page::saved? On which PW version are you?
-
You are obviously right! I am sorry... I tried your settings in a quick-and-dirty local Docker install using the blank site profile. I can use your whitelist no problem: This is what I added to the files:
-
This uses the PageNameTranslate rules which you can configure in Modules > Configure > InputfieldPageName. By default, it will replace ä with a, ö with o and ü with u. One of the first things I change on new sites. BTW: @bernhard's RockMigrations has an automation for this.
-
Error "Invalid Module Name" - Please assist
poljpocket replied to Greg Lumley's topic in Getting Started
Did this site - by any chance - reside on a Mac at some point? Mac file systems sometimes pull strange stuff like that (e.g. a meta file with a dot in front, but the exact same filename otherwise). ProcessWire just looks at everything in the modules directory and gets confused by that. -
Well, what I mean is that your deployments function won't work on any installation which needed the .htaccess edited (= comment out FollowSymlinks line) for ProcessWire to run properly. If you are checking for symlink function and work around it if it's not available, I retract everything I said :).
-
That's very sad to hear.. I used to use Linux during my university days (15 years ago) because for computer science, it just made the most sense. Later, I used Windows mainly because I was forced to do so at work (in the past). So finally, I decided to again move away from Windows right about when Microsoft really added an unbearable amount of bloat and tracking bulls*** with Windows 10 and later on 11. I first went with Manjaro because I thought it was an easy introduction to the "Arch way" but that was a mistake: Manjaro is still very opinionated and does a few things which didn't work for me. So this isn't any different to just using Ubuntu with pacman. So I took the courage and went full Arch. Installation isn't too bad if you know your way around the command line. Since I was using WSL on Windows and used to run Linux for years before, this isn't a problem for me. I must say, I have never looked back. Arch isn't very plug-and-play, that's true. But also, it doesn't stand in your way. Back then, I even moved my work PC to Arch after a few weeks because I got very confident with using it at home. There also, I never looked back: Everything is just faster and especially when your machine is idling, it is actually not doing anything. Ever. Gone are random "jetplane takeoffs" and slowdowns (search indexing, updates, antivirus). Also, on my Laptop, the battery lasts forever longer than with Windows. Right now, I am using a simple GNOME desktop environment on top of Arch. I am using PHPStorm and Docker CE for local development. All of these are just a few package installs away. No need to mention that web development is just so much easier on Linux. For my work scenarios: Printers are basically plug-and-play with Linux (much more than Windows!). Same for SMB shares on the network. Microsoft 365 has 99% of it's features in their web apps these days (Outlook, SharePoint, Excel, Word, ...), even Teams works perfectly as long as you are not using Firefox. What am I missing? Basically nothing important! There are a few very small things. One example: We have a Miracast thing in the conference room to share our screens to which just doesn't work for Linux. No biggie, because there is also a HDMI cable 🙂
-
Problem with og:image and WhatsApp / Meta Share Debugger
poljpocket replied to Žarko Kuvalja's topic in General Support
Not that this will solve your problem or have anything to do with it, but I can see a <head> tag inside another <head> tag when looking at your source code. W3C validity check brings some more problems to the surface, especially with your meta tags: https://validator.w3.org/nu/?doc=https%3A%2F%2Fzar.co.com%2F You could try fixing at least everything in <head> and try again. -
How would your structure look like in WordPress?
-
For such cases, even more readability: $wire->addHookAfter('Pages::saveReady(template=news)', function($event) { // [...] } This way, the hook doesn't even get called if template isn't news. Also, I think you can even get rid of the second guard clause like this: $wire->addHookAfter('Pages::saveReady(template=news,day!=)', function($event) { // [...] } If the page doesn't have a day field, the selector doesn't match and the hook isn't called. This is untested though 😊
-
Cool to see a project about my home country but not in my home country! Greetings from Switzerland! A very cool blog you have there. Model trains bring me back to my childhood, we had a ton of Märklin trains and of course, most of them were Swiss trains 😍 I think many of us feel this way. Welcome to the family 😊
-
Thanks @bernhard for that video. This puts a name on the concept I have used a bunch of times and I think is the only real way to solve OPs problem. Most ERP systems and also some well-known e-commerce systems out there (I know of Shopfiy and Shopware which do that) don't let you manage an item's quantity with a simple text field or a simple "number". Instead, the quantity is "event sourced" (as in the video) with a log of changes. This even includes the initial value. The video also says it, but as an example, one could come up with the current item's stock quantity of 8 by looking at this "event log": +10 from incoming shipment -2 from order -1 from order +3 from incoming shipment -1 from order -1 from order In ProcessWire, you could create a repeater to achieve this. Just record all your "incoming" lines with a repeater in your product (remember to add a datetime field) and add hooks to orders which automatically add lines when orders are placed/refunded/cancelled. The only remaining thing is to modify the repeater editor to only allow the user to edit new items. But a combination of limiting edit access to the entire repeater and a "update quantity" field like @bernhard and @da² suggested will get you there.
-
[SOLVED] How to save fields on a Process page of a module?
poljpocket replied to PWaddict's topic in General Support
Indeed, that is also an option. For your exact use case, there is the ConfigModule interface. It allows you to load/save exactly as you are doing but the differenc is, you don't need the getModuleConfigInputfields() method. I am on my phone so can't look up the code as easily. Edit: Here you go https://github.com/processwire/processwire/blob/3cc76cc886a49313b4bfb9a1a904bd88d11b7cb7/wire/core/ConfigurableModule.php#L40 -
[SOLVED] How to save fields on a Process page of a module?
poljpocket replied to PWaddict's topic in General Support
Hi @PWaddict, You are missing any means of dealing with your data. I don't mean to be rude, but you might have misunderstood what the processInput() call does on the form. All it does is take any input provided via GET or POST and fill the form fields with this data. This allows for further processing and re-rendering the same form with the prefilled data (e.g. when there was a validation error). You can find a hint of this in InputfieldWrapper, the parent class of InputfieldForm. Specifically, take a look at it's processInput() method. Any other action you want to take with the data provided is up to you. As an example, the core module ProcessModule does much of the same you are doing in your module when processing config fields for modules. You can find the method which takes care of the edit form here. It builds a form, processes it's input and renders the form exactly like your module does. But the key part is that it does something with the data, it saves it in the modules config right here after checking if there has been any changes to the data. Process doesn't provide any automatic means "configuring the process" like a ConfigurableModule provides in my example above. This is because most Process modules deal with data present in the database by other means. You must create your own database schema and save your data there if that is what you are after. -
You are completely right. Since strftime() is no longer a thing in PHP> 8.1, ProcessWire no longer uses it to format it's dates. Quickly skipping through the code, you can find that Ryan introduced a replacement for strftime() which uses date() and then translates the language-dependent parts using the PW translation system. Here's the section in question: https://github.com/processwire/processwire/blob/3cc76cc886a49313b4bfb9a1a904bd88d11b7cb7/wire/core/WireDateTime.php#L476 Remember, to get gettext-style translations working, you don't need any other modules activated than the LanguageSupport module itself. No need for PageNames and all the others. You can then just add a translation file for the WireDateTime class and translate the months, short months and days to German and you're done.
-
I would advise you to use Docker or DDEV for that. You could use my composition here as a starting point. It uses MariaDB 10.6 and apache+php8.2 (custom image which auto-installs PW). You can then replace the web container with a Litespeed+php container and configure it. You can refer to the Dockerfile of my custom image to get started with that. As for Litespeed, from my very limited experience, any serious hoster should be using the enterprise variant because, as far as I know, only that really offers full drop-in replacement for apache. This makes it hard to run locally without a license.
-
You are right. I also redacted my post to match your wording.
-
Now I feel bad because I thought I got you, but didn't. It's not about the frontend public website but about the edit experience in the backend PW admin area. My bad and I stand corrected: For that, the approach indeed makes a lot of sense!
-
No, I think I got you the first time :) But thanks for the clarification. Please, don't feel like I hate your proposal, I just think that with a watertight architecture, most of the logic in your examples should happen on the backend anyway. So, let me adapt my question to your example to show what I mean: Why not fetch() the "sold out" state from the backend? The backend already knows if an item is sold out or not because the backend must validate the order anyway and thus must have it's own concept of deciding if an item can be sold or not. So I as a module dev have to add a hook in JS to replace the price label in the frontend and additionally in the backend, block an order with a sold-out item in it with another hook in PHP. Even if we simplify your example down to just the currency format you would like to have customizable: What about your PDF invoice generator in the backend? Again, the backend needs to know the currency format and thus, there is no need to duplicate the hooks in JS for the frontend. I am sure there are examples where your proposal makes a lot of sense, like your second example which only changes the presentation of the data. For such things, I guess you should have a look at how the people over at Snipcart are doing their frontend customization, I really love their approach: https://docs.snipcart.com/v3/setup/customization
-
To test selectors, I use TracyDebugger's console panel. It is useful to run a code snippet and see what it's output is. You can use it to test your selector, e.g.: d($pages->find('selector...')); Here is some more info about the console panel: https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=console