-
Posts
70 -
Joined
-
Last visited
Everything posted by sebibu
-
(While the Pages::saveReady-hook is placed in ready.php ...) 1. I click on the save button on the page with pagetitle "Foo!" ich muss los 2. I fire the API $p->save() via TracyDebugger's console and save the page with pagetitle "Foo!" ich muss los. And get a wrong pagename with quot in it where " has been.
-
What could be the reason generated pagenames via my Pages::saveReady-hook that are initiated by hand over the Processwire backend with a " in the title differs from this fired in TracyDebugger's console via API $p->save(); like this: foreach($pages->find("template!=admin, has_parent!=2, include=all") as $p) { $p->save(); echo "Page {$page->title} (#$p) updated to {$p->name}<br>"; } E.g. Title: "Foo!" ich muss los Pagename via backend: 2025-01-10-foo-ich-muss-los ✓ Pagename via API: 2025-01-10-quot-foo-quot-ich-muss-los ✗ I would expect this to be the same result. Any ideas?
-
How to renew / regenerate pagenames for all pages?
sebibu replied to sebibu's topic in General Support
Thanks @bernhard! After shutting down the pc yesterday I got the cause. All pages without news template do not have a saveReady-hook. So for renewing pagenames on pages with other templates I simply have to temporarily create a new hook to set the pagename for other templates, too. Without the prepended news-published-day. Seems to work!☺️🙏🙋♂️ -
How to renew / regenerate pagenames for all pages?
sebibu replied to sebibu's topic in General Support
A very good hint to use TracyDebugger's console for that, @bernhard! Unfortunately in my tests the pagename is not renewed (or new set if empty) out of the pagetitle! foreach($pages->find("template!=admin, has_parent!=2, include=all") as $p) { $p->save(); echo "Page {$page->title} (#$p) updated to {$p->name}<br>"; } Any idea?👋 -
I discovered a bug in the pagename generation, see here: https://processwire.com/talk/topic/30444-prepend-date-in-page-name-by-hook-creates-improper-results-on-some-existing-pages/ If there is a final fix, I need to renew / regenerate pagenames out of all pagetitles for all pages of a website. How would you do this? Is there a GUI-way? Or via API with a foreach? With the help of RockMigrations? One pinch: All news pagenames should still be prepended with my hook listed in the forum topic above. Thanks in advance!
-
😅👍 I created a bug ticket for this: https://github.com/processwire/processwire-issues/issues/2015
-
Thanks for testing, @poljpocket! Interesting. Consistent inconsistent at least!😉 Yes, I discovered the punycode in the ascii-only name column. But you are right, this seems to be non-standard when I compare it with e.g. with the results from punycoder.com (Punycode converter IDN converter). I wonder whether the conversion to punycode is still appropriate at all!?
-
I tested a lot the last days also with fresh latest stable installs with blank site profile local in DDEV and on the server. Exported, changed the charset and reimported the database from utf8mb3 to utf8mb4. Now the german special character äöü work, but strangely enough not always!😳🤔 ✓ Die Kölner „Miteinander“ → die-kölner-miteinander ✗ Köln gegen Köln in Köln mit allen Köln Fans – die Kölner „Miteinander“ → köln-gegen-kln-in-kln-mit-allen-köln-fans-die-kölner-miteinander (two missing ö) Furthermore: ✗ Fuß → s (?? should be fuß) ✗ Füße → füsse (should be füße) I thought PageNameTranslate is not used when using $config->pageNameCharset = 'UTF8'; and ß is in the whitelist!? @poljpocket and other: Are you so kind and test if this pagetitles generate the same pagenames in your instances? Thanks a lot!🙏👋
-
Only one which is only for pages with one determined template. But the problem occurs for pages with all templates and even if the hook is disabled. The newest stable one 3.0.229 All modules up to date.😇 BTW.. PHP mbstring extension is enabled.
-
Thanks for testing, @poljpocket! Great to see that it is basically working. Testing with a fresh install would have been my next step to narrow it down.👍 Interesting. I see you are using in your .htaccess RewriteCond %{REQUEST_URI} "^/~?[-_/a-zA-Z0-9äöüß.+!*'(),] instead of RewriteCond %{REQUEST_URI} "^/~?[-_/a-zA-Z0-9äöüß.+!*'(),]*$" So *$" is missing, which is necessary only for resolving the page request. Not build the pagename. 👋
-
Hi @poljpocket, thanks for taking the time! By default PageNameTranslate with this rules is used, that‘s right. But I‘m using the Extended Page Name Feature for UTF-8 support. Then this rules are hidden and not used. Please see here: https://processwire.com/blog/posts/page-name-charset-utf8/
-
Unfortunately I have to come back to my still existing pagename problem. This does not have anything to do with the hook. In general the pagename is shown correct in the preview before saving: But after saving special characters are removed: What am I doing wrong? I'm using this Extended Page Names feature: https://processwire.com/blog/posts/page-name-charset-utf8/ site/config.php: $config->pageNameCharset = 'UTF8'; $config->pageNameWhitelist = "$-_.+!*'(),äöüßÄÖÜabcdefghijklmnopqrstuvwxyz0123456789"; .htaccess: RewriteCond %{REQUEST_URI} "^/~?[-_/a-zA-Z0-9äöüß.+!*'(),]*$" How to debug this? (Haven't configured PHP debug in VSC with DDEV.😆) 🙏👋
-
Thanks @bernhard!👍 Commenting out this line... class Text extends Block { const prefix = "rpb_text_"; public function info() { return [ 'title' => 'Text', //'spaceV' => self::spaceM, ← HERE ... did the trick.☺️ 👍
-
I'm just wondering how to hide the frontend editing block-buttons vspacetop and vspacebottom!? On one website they are already disabled but I don't now how I achieved this.😇 For a quick'n'dirty CSS-hack there is no id or class given. Thx for a quick hint!👋
-
Thanks for your help! Trying.. {var $map = wire('modules')->get('MarkupLeafletMap')} {$map->render($page, 'map')} ..in RockPageBuilder block LATTE-file I get: Call to undefined function wire() in block Trying.. {var $map = $this->$wire('modules')->get('MarkupLeafletMap')} {$map->render($page, 'map')} .. I get: Method name must be a string in block Now I'm confused. 😆 What I'm doing wrong?
-
Thx @wbmnfktr for taking on ProcessWire Recipes and the time for caring and asking this questions! To be honest.. Yes, I would expect (and maybe even demand😇) that ProcessWire related projects like this are built with ProcessWire itself. Especially for sites with structured and tagged content like on ProcessWire Recipes, PW is predestined, I think.😉🙋♂️
-
I really love LATTE (Template Engine by Nette) but here and there I still have problems with the syntax. I'm using RockPageBuilder by @bernhard and try to output the html for this module: https://processwire.com/modules/fieldtype-leaflet-map-marker/ In PHP this would be: <?php echo $map->render($page, 'YOUR MARKER FIELD'); ?> And in LATTE? 😆 I tried this variants and more: {$map->render($page, 'map')} {$map->render($page, 'block->map')} {$map->render($page, $block->map)} Getting: Call to a member function render() on null in block #1158 (rockpagebuilderblock-map) Maybe this topic can be a collection point for smaller Latte syntax questions.
-
Thank you @poljpocket for this good optimizations!👍 While searching for hooks I stumpled across this syntax but didn't tested and then forgot it.🤓
-
Thank you @bernhard for helping optimizing the code!👍 For checking the template field I already used a guard clause, but for the template check it makes sense and is more readable to use it, too. I would like to keep the german special characters like äöüß instead of exchanging (->pageNameTranslate) them with ae, oe, ue, ss. So wire('sanitizer')->pageNameUTF8($title); should be the way to go. Right?
-
Hey Procis, wrote this - and my very first - hook „Prepend date in page name“, yesterday. Once you get it, this system and the API is magnificent. Thank you @ryan and @all contributers! On new (news) pages it works great so far. E.g.: Title: Testnews mit Ümläüten Altered page name: 2024-09-24-testnews-mit-ümläüten But on existing pages special characters are removed. E.g. Title: Partnerschaftliche Unterstützung - Ihr werdet gesucht! Altered page name: 2023-07-27-fans1991-partnerschaftliche-untersttzung-ihr-werdet-gesucht Another example is attached. There you can see, that the ProcessPageEdit-message shows the right path!? I have this in my site/config.php to allow only german special characters: $config->pageNameCharset = 'UTF8'; $config->pageNameWhitelist = '-_abcdefghijklmnopqrstuvwxyz0123456789äöüß'; Temporary uninstalled Module „PagePathHistory“ with no look. The code of my hook (suggestions for improvement are very welcome!): /* NEWS pages only: prepend date in page-name */ $wire->addHookAfter('Pages::saveReady', function($event) { // get current Page object — in this case this is the first argument for the $event object $page = $event->arguments(0); // Only for pages with news template if($page->template == 'news') { // Test if field day exists, otherwise exit if (!$page->template->hasField('day')) { $event->message("Field 'day' is missing!"); return; } $title = $page->get('title'); // Sanitize title and substitute special characters $optimizedTitle = wire('sanitizer')->pageNameUTF8($title); //$optimizedTitle = wire('sanitizer')->pageName($title, Sanitizer::okUTF8); // or translate option $date = wireDate('Y-m-d', $page->day); // Set output formatting state off, for page manipulation $page->of(false); $page->name = $date.'-'.$optimizedTitle; //$page->save('name'); $event->message("New saved name is $page->name"); //$event->message("Path of new saved page is $page->path"); } }); Any idea why this doesn't works on all existing news, too? Thx and 👋 Sebastian
-
Thanks @bernhard for helping me out yesterday! Will try to include jQuery only on the necessary pages with a different implementation in the new week.
-
@bernhard Do you have any ideas on this? Thx & greetings!?