-
Posts
720 -
Joined
-
Last visited
-
Days Won
3
Everything posted by froot
-
issues with setting the name of multilingual pages
froot replied to froot's topic in API & Templates
I'm trying to boil it down but it's difficult to say what the issue is. I have e.g. 4 pages with the same title. In the default language (or maybe in the activated language for this user?) the naming of the page, when derived from the title, iterates i.e. a hyphen and a number is added at the end HOWEVER that doesn't seem to work when the letter format doesn't match so "Some Page" and "some page" get interpreted as different titles hence get the exact same name, which causes troubles (404) AND in whichever language that is not default (or not activated for this user?) the names do NOT iterate in the same fashion, i.e. do NOT get a hyphen and a number at the end. I tried @adrian's module PageRenameOptions but not sure how this works. Does it, on submission, change and save all the pages? Or overrides them? It seems not solve the above mentioned problems anyway… thanks for help! -
I have a multilingual PW installation with default (Deutsch) english (English) I have imported a lot of pages and I created a Admin Action that lets me upload a CSV file and set the fields on the page which worked fine. I'm now trying to set the names of the german and the english page according to the page's title. so I here's my code: protected function executeAction($options) { $url = config()->paths->assets.'cache/AdminActions/'; if (count($options['csv_upload'])) { $n = 0; $file = $options['csv_upload']->first(); $fp = fopen($file->filename, 'r'); $count = 0; while (($row = fgetcsv($fp, 0, ',', '"')) !== false) { $count++; if (++$n === 1) { // Store the field names based on the first row of the CSV $fieldNames = $row; continue; } // Get the page_id from the first column of the current row $page_id = $row[0]; $target_page = pages()->get("id=$page_id"); if ($target_page->id) { $target_page->of(false); // Set the field values dynamically based on the field names and row values foreach ($fieldNames as $index => $fieldName) { if ($fieldName !== 'page_id') { $fieldValue = $row[$index]; $target_page->set($fieldName, $fieldValue); if ($fieldName == 'title_de') { $name = wire('sanitizer')->name($fieldValue, true, 128, '-'); $target_page->setName($name, 'default'); } if ($fieldName == 'title_en') { $name = wire('sanitizer')->name($fieldValue, true, 128, '-'); $target_page->setName($name, 'english'); } } } $target_page->save(); $target_page->of(true); } else { $this->error("$target_page is not a project"); continue; } $target_page->of(true); } $this->successMessage = "$count CSV rows were processed."; fclose($fp); $this->wire('files')->unlink($file->filename); return true; } else { $this->failureMessage = 'Please upload a CSV file'; return false; } I managed to set all other multilingual fields of the pages just fine when having the right language active for my user. It seems to be different for the name though, I think I need to use $target_page->setName($name, 'english'); for it to work. However, the results are inconsistent, especially when I have multiple pages with the same title. (German page gets the English name, English name doesn't get a -1 (or -2, or -3) added to the end). I cannot quite put my finger on how that works exactly, but it seems to depend on whichever language is active for my user. First I thought the language status of the page (status1021 for english in my case) cause the problem, it was set to 0, so I changed that to 1 but that didn't help either. So now I ended up with inconsistencies, e.g. the same name and url for pages with the same title which results in a 404 for all of them. And now even changing it manually doesn't fix it. Thanks for help!
-
I just uploaded 800+ images to MM (with Scan + Publish) but when I jump to page 2 (or any further) of the pagination, I get a Error retrieving results: [object Object] and do not see any images on the following pages. BTW I very often have issues like that with pagination in PW admin in general, so maybe this is more like a core issue. (PW 3.0.210)
-
how does that work? Each image still lives on a page object, right? What are the folders technically speaking? Will it be possible to move existing images into folders without destroying the image path?
-
We have different pages using the same images, that's why I wanted to give MM a try. Now there's unfortunately no possibility to have any structure in the MM – other than the type of media – but no subfolders, no parents. So I thought, if I could just filter/search an image by the page that it is already used in, that would be a work-around. I would just upload the image at the input field of the first page I want to use it in directly and for the other pages find the images by the title of the page where I uploaded it. But you cannot do that either. All I can do is filter the name of the image which is kind of a drag because our naming convention is quite messy and we migrate from a different CMS.
-
not sure if this has been asked before, is there a way to filter the media by the page that they are used on?
-
I don't know and it's very hard to find out because everything image related in the CMS is very unreliable for lack of a better word. I don't know if the images are cached somewhere, on the server, in the browser? Any changes I take don't have any effect, setting the image focus manually in the input dialogue, not even rotating or flipping changes anything. I delete all image variations, rename the images, nothing helps. All stays the same so it's hard to say if the API is correct or not.
-
…doesn't work if you also set a size? like: $thumb = $foo->images->first->focus(0,0); // works $thumb = $foo->images->first->size(400, 400)->focus(0,0); // doesn't work
-
just curious, what framework does this very proccesswire.com community forum use? First I though it's some from scratch side project by processwire but then I came across https://forum.affinity.serif.com Hi there, I can answer that ? https://invisioncommunity.com/
-
I will look into that and post my code eventually. thanks!
-
I ran the first query, it says @@character_set_database utf8mb4 @@collation_database utf8mb4_german2_ci so that setting doesn't solve my problem after all… should I try with utf8mb4_german2_ci ?
-
yes it is in the list. Actually I don't know anymore where to set the CharSet at all (let alone that I didn't find utf8mb4 in the list). I think mixed it up with the dropdown in the import tab. So how to set the CharSet to begin with? And then, I thought I changed the collation for one specific database but it seems like that's a setting that applies to the whole server? Not good…
-
Browsing users to next page gives error: Unknown action
froot replied to lpa's topic in General Support
how can we report this bug? -
it says 5.7.33-log
-
I cannot find the MySQL version. It's not in the database settings in the host and there's no Database server widget when I click on the home icon in phpMyAdmin and also I do not have SSH access. Something so simple, so far…
-
I tried that. First of all, I don't see utf8mb4 in the list of charsets, as suggested in the stackOverflow answers, so I cannot select it. Then, trying to change the collation to utf8mb4_unicode_ci or utf8mb4_german2_ci doesn't help, I think it requires the charset to be set to utf8mb4 as well. If I check "Change all tables collations" and "Change all tables columns collations" I get an error like so The behaviour in the frontend of my project doesn't change anyway. I'm not very knowledgeable in that area anyway, so thanks for help!
-
thanks, ->selectorValue seems good BUT it breaks when the value contains Umlaute (äöü) It puts the value in between double quotes "" which breaks the rest of the selector and whatnot. ?
-
I have an issue with selectors, whenever there is a comma in the selected value… $foo = $item->foo; // "what, ever, with, commas" $bar = pages()->get("template=foo_template, title=$foo"); then I get Fehler: Exception: Unknown Selector operator: '[empty]' -- was your selector value properly escaped? (in wire/core/Selectors.php line 222) Because it thinks that what ever is after the comma is the next selector. Though the value in question is not expected to have commas, this shouldn't happen. How can I escape it properly? And then, also, even though I'm NOT in config debug mode, Tracy Debugger is NOT active and I am NOT logged in, i.e. not superuser, I still get the error in the frontend, breaking the entire output script, showing me no CSS (I use markup regions). That's of course not a good user experience. Shouldn't it show a white page instead? Do I have to use a try-catch code block?
-
need to pick this up, as new issues arose. with PW 3.0.207 the pagination seems to work fine on admin templates, but for ProFields Table, the pagination neither works in .207 nor in .200 though the behaviour is slightly different. I guess I need to update, i.e. buy the newest update of that module then?
-
this works like a charm! thanks a lot @gebeer
-
Thank you all a lot for your efforts, at least I'm not alone here… One more thing, in the process module, I'm trying to amend the $results->getPaginationString() I have: 'count' => count($results), 'start' => $results->getStart(), 'limit' => count($results), 'total' => $results->getTotal() But I would like to use a specific field of the first and last result in the array on any given page, much rather than what ever $results->getStart and count($results) returns. I cannot just do 'start' => $results->first->someField;
-
We recommend downloading the dev version if you are using it locally for development, while we recommend downloading the master version if it will be immediately used in a live/production environment (like if you are upgrading an existing installation). It is also generally safe to use the dev version in production after thorough testing in an non-production environment. – https://processwire.com/download/core/
-
OK I just tried something else… upgrading to dev branch 3.0.207 (newest dev branch), replacing master branch 3.0.200 THAT WORKED!! Now that's not to say there won't be any other issues that I'm not aware of at this point because, you know, it's the dev branch but at least that tells us something, right? Not sure what it tells me but it just seems to be a bug that has been fixed? So when is the next master version coming? Needless to say I would like to avoid using the dev branch for a live site.
-
OMG this is so frustrating. here's some other stuff I tried uninstall all modules delete all modules delete all unused field delete all unused templates empty the trash (actually deleted the modules from the file system first and then under "missing" deleted all modules one by one from the database) delete the cache table in the database delete the cache folder in the file system mess with the .htaccess file switch the admin theme turn on and off javascript for this browser use other browsers absolutely nothing helps and no error whatsoever. What else is left to try? What would you do next? uninstall PW start over? Are there some phpmyadmin settings that I'm not aware of? thanks for help