-
Posts
409 -
Joined
-
Last visited
-
Days Won
2
3fingers last won the day on March 8
3fingers had the most liked content!
About 3fingers
- Birthday 04/22/1981
Contact Methods
-
Website URL
https://www.3fingers.com
Profile Information
-
Gender
Male
-
Location
Turin, Italy
3fingers's Achievements
-
How to access first element of Page Reference field using a selector?
3fingers replied to Clarity's topic in API & Templates
What about: $pages->findOne('page_reference=value') Not tested but findOne method should return just the first occurence of the page array. -
How to access first element of Page Reference field using a selector?
3fingers replied to Clarity's topic in API & Templates
https://processwire.com/api/ref/wire-array/first/ -
May I ask you why are you trying to resize svg? Svg are scalable by nature, so my personal approach you be to size them via css or html attributes on the svg tag itself.
-
// Get images of the author if they exist if count($page->images): echo $page->images->each(function($image) { return "<li><a href='$image->size(100,100)->url'>$image->description</a></li>"; // Just an output example }); // Otherwise get images of their book covers else: foreach($page->page_ref_for_their_books as $all_pages): foreach($all_pages->images as $image): echo "<li><a href='$image->size(100,100)->url'>$image->description</a></li>"; endforeach; endforeach; endif;
-
Looking at your pseudo-code you're outputting a single image (the first one) from the page reference field, so you don't need to loop through it. // Get images of the author if they exist if $page->images !='': foreach $page->images as $source: echo $source->size(100,100)->url; endforeach; // Otherwise get images of their book covers else: $source = $page->page_ref_for_their_books->images->first; echo $source->size(100,100)->url; endif;
-
You can translate your "C" inside admin translation files, the right one is: wire--modules--languagesupport--languagesupport-module for each language you can define the setting there. More on setlocale here, if you want to set it via api: Docs
-
You can configure your locale, according to your server settings, inside site/config.php like this: setlocale(LC_ALL, 'it_IT.UTF-8'); // where 'it_IT.UTF-8' is MY locale setting. You can find a list of all locales here on Stack Overflow
-
<img src="<?= $page->my_image_field->url ?>" alt="<?= $page->my_image_field->description ?>"> // never forget to add "alt" attribute here In your example the "url" property was missing.
-
htmx: Auto-refresh Frontend Content on Backend Page Save
3fingers replied to kongondo's topic in General Support
This looks really cool but I have to admit that I would have to look at the code to really understand what's going on 🙂 It looks like you are mastering htmx a lot lately, nice job!- 1 reply
-
- 1
-
-
Change Field value based on a checkbox in front-end
3fingers replied to Val_0x42's topic in Getting Started
Just to be on the safe sife I would try to get those input variables like this: // On the php file whom handles your inputs (REMEMBER, IT HAS TO BE PLACED OUTISDE THE "template" folder) $page_id = $input->get->int->pageid; $status = $input->get->text->status; Moreover, as a test I'd try to use a relative path for your ajax call: $.ajax({ type: "GET", url: "./../ajax/file.php", // or wherever your file is placed/called data: { pageid: ckVal, status: ckStatus }, success: function(){ console.log(this.url); } Let us know 🙂 -
Try: $wire->addHookBefore('Pages::saveReady', function($event){ $page = $event->arguments(0); if($page->hasField("my_checkbox")) { if($page->my_checkbox == 0) { $page->setAndSave('another_integer_field',0); $this->message("This should have worked"); //for debugging only } } });
-
@kongondo Here I've found an interesting article about SSE and php and one thing mentioned, to avoid session locking (which I think its our culprit here) is to use: // make session read-only session_start(); session_write_close(); Above everything else in the code used to send data. I cannot test it at the moment, would you mind to have a check and report it back to us? 🙂 I've found however possible bad implications doing this, as mentioned here in the forum.
-
I think the best approach would be to use css ::first-line pseudo selector for that.
- 1 reply
-
- 4
-
-