-
Posts
6,662 -
Joined
-
Last visited
-
Days Won
366
Everything posted by bernhard
-
I have updated my code, but did not test it.
-
<?php $wire->addHookAfter("Pages::saved", function (HookEvent $event) { $page = $event->arguments(0); // early exits based on your needs if($page->template != 'your-static-template') return; // save some variables for later $lang = $this->wire->user->language; $user = $this->wire->user; // create markup for all languages // render everything as guest user $this->wire->users->setCurrentUser($this->wire->users->getGuestUser()); foreach ($this->wire->languages as $l) { // key for page meta data, eg static-german or static-english $key = "static-" . $l->name; // set temp language $this->wire->user->language = $l; // render page and save it to meta data $page->meta($key, $page->render()); } // change user back to what it was $this->wire->users->setCurrentUser($user); $this->wire->user->language = $lang; }); This would save the static markup in $page->meta("static-default") or $page->meta("static-english") etc... You can then do whatever you want with that piece of data ? You could also create files instead of saving everything to the database - depends on your setup which would be better.
-
Thx @BrendonKoz ? Luckily I seem to be right here: https://processwire.com/talk/topic/27692-i-have-to-switch-from-processwire-to-drupal/?do=findComment&comment=227662 At least it's everything I know. And you are right, it does not really matter ? Thank you very much ? Unfortunately I have some hickups in the webcam stream sometimes. I also got that from time to time at home. Not sure where that comes from ? I think maybe it comes from the cheap usb hub and I should likely use a proper usb port for the webcam ? Thanks ?
-
Automate Repeater Matrix types creation with RockMigrations
bernhard replied to Ivan Gretsky's topic in RockMigrations
Please let me know when you think I can merge your changes @gebeer -
Automate Repeater Matrix types creation with RockMigrations
bernhard replied to Ivan Gretsky's topic in RockMigrations
I don't know the current state and if you ask me, wait a little for the launch of RockPageBuilder ? But besides that it should really not be a problem to bring support for RepeaterMatrix to the new version of RockMigrations. It should just be pulling the methods from RockMigrations1 into the new module. If you search for "matrix" in https://github.com/baumrock/RockMigrations1/blob/main/RockMigrations1.module.php you'll see all the necessary methods. @gebeer what's your progress on this? ? -
Which ones? I've found that for example in umami you can add users whereas in plausible you only have one? Also backing up the umami container eats up 4GB of data on my vps and I have no idea why at all it would need so much space for just a few statistics... umami seems to be very more lightweight.
-
Thx everybody! If anybody else wants to present ProcessWire at some Meetup I can share the slides of course! The project is on github: https://github.com/baumrock/meetupwall
-
@wbmnfktr I wanted to try umami and set it up on my server, but when I try to display the shared dashboard in the iframe I get this: fused to frame 'https://...' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'". Google brought no helpful result. Do you have an idea?
-
Hi @BrendonKoz thx for the hint. I had a look and turns out I already have that extension installed ? Without that extension latte files have no highlighting at all. With the extension we get syntax highlighting for html but not for the parts within n:attributes. That's the only thing missing but it's really not a big deal fortunately ? Yeah, you are right. Also the PHP Meetup Vienna on the right side is a little covered. But the recording was kind of improvised so I'm very happy that everything worked out well. I've done the recording with a microphone that arrived at 14:00 on the same day of the talk ? And then at the talk I realised that my OBS settings don't work, because I'm not using an external monitor. Then I had to change some scenes and had to stretch the video to fill the video frame... Not ideal but also no problem imho. But I could try to put some kind of "logo" or watermark at the position where the face-video will be lateron so I could try to avoid that area when working on the presentation! I hope so ? Thx! PS: What about the dependencies? I guess I was wrong with that question ? We have jQuery and UIkit as dependencies for the backend. But I was thinking only of the PHP side of things. Did I miss anything else? I think it's an interesting question and as we are getting more and more attacks on that front it might be another plus for ProcessWire ?
-
I did my first talk ever yesterday @ PHP Meetup Vienna!! Once more everything was a lot more work than I first thought, but I'm quite proud of the result ? What do you think? Did I forget something important? It was really hard to put 10 years into one hour... The recording was not planned at first, but I thought I'd just give it a try and everything worked quite well ? If you like what you see please share it with others so that ProcessWire gets the attention that it deserves ? Special thanks to @gebeer for showing me ProcessWire in 2013 ?
- 18 replies
-
- 35
-
-
-
Great to hear that, thx for letting me know ?
-
The problem has two dimensions 1) ProcessWire You need to execute the long running task somehow in the background. There are many ways how to do that. The simplest solution could be a cronjob that runs every minute, bootstraps PW and executes all open tasks. If your task can run longer than 1 minute then you need to implement some kind of locking mechanism or as an ugly alternative just run the task every 5 minutes or so. We also have WireQueue that could help maybe. 2) Sending Mails If you are on a shared host I doubt that it would be a good idea to send emails from there. Either the hoster will have limits in place or, if not, mails will likely not land in the users inbox because chances are high that the hosters IP is blacklisted somewhere. If you have a dedicated VPS you should be fine, but I have no experience in how many emails you can send from one single VPS realistically and I'd be very happy to get some numbers if anybody else has experience in that area! ?
-
In recent versions we have $page->get("images.first") and get("images[]"): Note that getUnformatted is NOT the same as [] --> the unformatted value will hold temporary images whereas images[] will not. See https://processwire.com/talk/topic/26952-get-image-in-the-context-of-a-hook/ and https://processwire.com/talk/topic/27528-weekly-update-– 2-september-2022/
-
Awesome, thx! I've been reading that page, but not carefully enough ?
-
Just a quick question to make sure I'm not missing something obvious. If I had some page meta data, like $page->meta('foo', 'my foo value') and $page->meta('bar', 'my bar value') I'd expected that $page->meta() without any arguments gave me an array like this: [ 'foo' => 'my foo value', 'bar' => 'my bar value', ] But it returns an emtpy WireData WireDataDB object. Is there an easy way to get the data that I want or do I need to build my own SQL query? Thx!
-
Hi @Guy Incognito thx for the input. RockMigrations needs PHP>=8.0 and ProcessWire should warn you about that before installation: https://github.com/baumrock/RockMigrations/blob/1089f625048c4c68e883e46d1d57d7153c155bf2/RockMigrations.info.php#L14 So you did a fresh install and got an error without PW showing the requirement fails?
-
Feedback about my start and progress with PW
bernhard replied to daniel712's topic in Getting Started
You don't have to enable JS in PW. And you can't. ProcessWire just manages content for you and then sends data to the user's client, that is visiting your website. Usually that data is HTML markup. In that markup you can tell the browser to load or execute JavaScript. You can either use inline JavaScript like this: <script> alert('I am a JavaScript alert'); </script> That should pop up a JS alert when visiting the page that outputs that lines of html. The other option is to load an external JavaScript file, which would/should work exactly like you wrote above. I recommend to put only this into the file until that works and then proceed: alert('works'); You can use RockFrontend to use the Latte template engine. I love it. This is how it would look in your example: <a href="#"><img src="{$config->urls->templates}images/logo.svg" alt="Manage"></a> <button class="mobile-nav-toggle" aria-controls="primary-navigation" aria-expanded="false"> <img class="icon-hamburger" src="{$config->urls->templates}images/icon-hamburger.svg" alt="" aria-hidden="true"> <img class="icon-close" src="{$config->urls->templates}images/icon-close.svg" alt="" aria-hidden="true"> <span class="visually-hidden">Menu</span> <!-- screen-reader ... accessability --> </button> You could also just use PHP's short tag syntax: <a href="#"><img src="<?= $config->urls->templates ?>images/logo.svg" alt="Manage"></a> -
Yeah, sorry, been talking about the PW logfiles of course ? That's why I posted it in "PW general support" and not "dev talk", but I changed the post title to make it more obvious, thx! Now I understand the answer of @wbmnfktr better ? I'm not sure yet if I really like to auto-prune logs to a given size/length/age... I think I'd prefer to get an email when logs grow too much. Do you have some code to share with us?
-
Today I've had a site with a logfile that has grown to 70MB over the years... PW is so low-maintenance that I usually just deploy and forget ? Now while having that 70MB is not really an issue - all parameters still by far in the greens - it's definitely something that could be improved. So I'm wondering: Do you do regular maintenance on your site? Or do you have a script in place that prunes logfiles? I could think of some kind of notification system that sends me an email if one of the logfiles grows over a defined filesize. Or a cronjob that automatically prunes logs to x days. What dou you think? How do you handle logs?
-
@gornycreative the issue is already fixed on the latest dev: There has just not been a version bump since then.