joe_g
Members-
Posts
395 -
Joined
-
Last visited
Everything posted by joe_g
-
add years to pagination (tricky one, maybe impossible?)
joe_g replied to joe_g's topic in General Support
Yes, it's a sidescroll so you can easily swipe right as if the pages form a timeline. Since a page corresponds to the amount of stuff you already see on the current page you get a kind of intuitive feel for how much a year contains. A sort of physical representation of everything that has happened. Although it could become years instead of pages for past years, but it gets a bit tricky with a 2 level pagination perhaps. I imagine you click 2022, see pages and you would need to go back to 2024. Now, since you brought this up. The whole thing could potentially be only months and years instead of pages - but that is equally hard to calculate. Not all months have events and should be represented. Yes it would need to be custom sql, i suppose -
Hey experts, I had this cool idea I would love to implement, but so far I didn't manage to do it with good enough performance. I've got some date fields on a page, and I'd like to have years indicate on the pagination pages, like so: What I tried is to read all the results, read all the years for each results, then slice them up in pages. This is way to slow, obviously. Only thing i could think of is to make a nightly batch job that calculates the pagination, but it starts to get a bit messy and could easily be out of sync. This is no life-and-death situation, it's just something I would like to do. If you have any ideas how to solve this I'm curious to hear it.
-
Hey experts, I ran into this today: A client has a site with lots of languages (12). I just learned about multilingual fields where any field can become multilingual, which is great. My problem is that I don't know what languages the client want to make language-specific images for. In most cases the default images-field is fine, but sometimes there is a secondary language (in this case Spanish). Is there a way I can allow the client to add a language to a multilanguage field? Perhaps a combo of repeater and images field, or some sort? I suppose I could create a version for every language. The drawback is that I would have to remember to update this field in parallel with the real languages. If the client adds polish tomorrow, I would have to add a polish alternative version of these images. It's not the end of the world, and that is probably what I will end up doing, just curious if there is more neat way? thanks!
-
Interesting! I didn't know about HLS and doing it myself doesn't seem too bad actually
-
One strategy would be to store all the original video files on the website as file uploads, and then use mux for conversion and delivery. At least then there a pinch less of a lock-in. Then, maybe at some point there might be a self-hosted mux alternative (or I make one based on ffmpeg). That could be a way to do things?
-
Hey all, My projects involves more and more video. For a couple of years I've been self hosting mp4's. It works okay but it's always a hassle with determining the bitrate and getting the clients to understand that kind of thing. I don't want to go back to the bad old days of embedding. Mux.com looks good, but then all video material is locked up in their servers and it's hard to move. I don't love the idea to be tied to them forever. My dream would be to have something similar to image->width(500), such as video->bitrate(3000) for 3mb per second, for example. So that the editors can upload whatever video file. I think this would be not that hard to achieve with ffmpeg? I've been toying with the idea to do something like this myself. Anyone else? J
-
Uncheck Active without 404? Or other way to deal with languages?
joe_g replied to joe_g's topic in General Support
yes, you made me understand 'viewable', that's great. But i can't control internal links done in ckedit (for example). Maybe ckedit is linked to /es/page and that doesn't yet exist (but perhaps a week later someone makes a spanish translation). It should work both now and later. -
i use hetzner for everything since some years
- 10 replies
-
- 1
-
- hosting services
- vps
-
(and 1 more)
Tagged with:
-
Uncheck Active without 404? Or other way to deal with languages?
joe_g replied to joe_g's topic in General Support
@gebeer Is what you describe some native setting or is it part of your module? -
Uncheck Active without 404? Or other way to deal with languages?
joe_g replied to joe_g's topic in General Support
The problem is not the language switch, it's everywhere else the page is linked. It wouldn't be enough to check if it's 'viewable' in the language switch - it would have to happen everywhere. That would be hard. But the 302 redirect setting makes this a non-problem -
Uncheck Active without 404? Or other way to deal with languages?
joe_g replied to joe_g's topic in General Support
Thank you both. @virtualgadjo I would love to stick to the native "active" if i can, however it's a bit cumbersome to check if a page is "viewable" *everywhere* when its being linked to. It could be in the language switch, but it is linked in lots of places. I Example: /es/hola-amigo (spanish page) /about (default about) /nl/about (dutch about) /es/about (NOT ACTIVE, DOESN'T EXIST) If i link from /es/hola-amigo to /es/about (without checking if it's viewable) i get a 404. What I like it to do is to instead go to /about .........Aaaaaaaaaaaaaaaaaaand after looking around a bit, there it is. This is what I didn't know existed because I didn't look hard enough 🤦♂️🤦♂️🤦♂️🤦♂️ thanks for the help! J -
Uncheck Active without 404? Or other way to deal with languages?
joe_g replied to joe_g's topic in General Support
Yes thank you. I don't think I explained myself very well. So I have a website with 13 potential languages, not all of them are used everywhere. Most pages have 2-3 languages out of these 13. I would like to show a language switch for the languages that has been translated (in most cases 2-3 languages). The problem is that there is no easy way for me to know what languages has actually been translated. I can't go through all the fields and compare them to the default language because it's tons of repeaters with text fields with footnotes and whatnot. It would easily be over 20-30 textfields to compare so this would be inefficient. So, I would need some kind of mechanism or switch that the editor can use to say "this language is in use". I can't use the "active" switch because if i switch it off the page gives a 404. Ideally, active=off would mean "return the page with the default language", but that's not how it works. I would like to add my own checkbox called "use this language", but I don't think there is anything like a "Multilingual Checkbox"? What i do now is that i compare the title with default, if it's different then I assume the page is translated. This does't work very well since the title sometimes stays the same. The client is not so happy with this solution. The only way to achieve this that I can think of is to have a text field called "is this page translated" that the editor would fill in with anything (such as "yes"). But that feels soo hacky and weird. Is there a better way? -
Silly forum thing: Can't find 'mark as solution' button in the forum
joe_g replied to joe_g's topic in General Support
I posted this as a joke, but that sounds like a good idea. I'm not sure I have permissions to change the title? -
Silly forum thing: Can't find 'mark as solution' button in the forum
joe_g replied to joe_g's topic in General Support
-
Hey hello, So i've got a site with no less than 13 languages. Not everything exists in all languages. The way "active" works is that if it's unchecked, then that particular language-version of a page gives a 404. What I'd like it to do instead is to still show the page, but with the content from the default language instead of throwing a 404. Ideally no page should ever give a 404. However, I suppose that's not so easy to accomplish? The plan B would be for me to implement my own "active" switch. But I don't think there is such a thing as a multilingual checkbox (that can be checked individually per language). Or is there? Maybe there is a third way I don't see right now?
-
Silly forum thing: Can't find 'mark as solution' button in the forum
joe_g replied to joe_g's topic in General Support
haha ok, good to know -
Thanks! That sounds great, I'll try that. I think i just graduated to yellow belt in hooks
-
aha, this code (in admin.php) seems to be the culprit: Leaving this code and saving many times (it will fail to save every 2-5 times) and then eventually the mysql install dies entirely. I think it's the first time I managed to truly crash a PW install. You think I might be doing something verboten in the code below? $pages->addHookAfter('saveReady', function($event) { //the following code borks the database! if($p->template->name == 'event') { $home = wire('pages')->get('/'); if(!$p->onfrontpage) { $home->of(false); $home->home->remove($p); $home->save(); } if($p->enddate>time() && $p->onfrontpage) { if(!$home->home->has($p)) { $home->of(false); $home->home->add($p); wire('pages')->message('Added ' . $p->title . ' to the homepage'); $home->of(false); $home->save(); } $p->of(false); $p->onfrontpage = 0; } } }
-
aha thank you! In the mean time the server crashed, pdo_mysql disappeared somehow. If i try to make a new PW install i get "PDO (pdo_mysql) is required (for MySQL database)". So I moved the site to a new server and to my surprise the sometimes-not-saving bug is still happening on the new server. It almost feels like i have two unrelated problems. In any case, when saving it looks normal - changes are listed (below) it's just that it doesn't actually save anything. I'll try a site-export-import next, to see if i that can clear some database problems...
-
Hey there, I run into a strange problem with a live site that's been running okay for quite some time. I installed sury so it runs the latest php always (this was before debian shipped with php 8). So the only thing that could have changed is the php version... I think. Its on php 8.3.13 and PW 3.0.229. Anyway, if i create a page with some text field it saves ..sometimes. On average every second time. I press save and the page reloads, but then sometimes without the latest update. There is nothing in the PW error log, nothing in the apache error log, also no console errors. To make things weirder, I have another test version of the same site running on the same server and that one is working great. So it might actually be that something is up with this particular install... I'm totally stumped. If you got any ideas i'd love to hear them!
-
Hey solved it like this, a bit more low-tech: Added the $page-id != 0 check And this is FANTASTIC. Having to choose between image upload (with drag and drop) and the flexibility of the repeater matrix have been my #1 annoyance for a decade!! $wire->addHookBefore('Pages::saveReady', function(HookEvent $event) { /** @var Page $page */ $page = $event->arguments(0); if($page->template == 'fragments') { if($page->id != 0) { foreach($page->upload_files_to_matrix as $pagefile) { if($pagefile->ext == 'mp4') { $item = $page->fragments->getNewItem(); $item->save(); $item->setMatrixType('mp4_block'); $item->mp4->add($pagefile->filename); } if($pagefile->ext == 'jpg' || $pagefile->ext == 'jpeg') { $item = $page->fragments->getNewItem(); $item->save(); $item->setMatrixType('image_block'); $item->image->add($pagefile->filename); } $item->save(); } $page->upload_files_to_matrix->removeAll(); } } });
-
Hey there, So I'm trying to update a checkbox in the admin depending on a condition (if the current page exist in a PageArray elsewhere). I'm not sure how to navigate the hooks to achieve this. I suppose I'm trying to do "before render, check if this page exist in the PageArray, if yes, set checkbox to checked, otherwise leave unchecked". many thanks!