-
Posts
1,065 -
Joined
-
Last visited
-
Days Won
11
Everything posted by Zeka
-
Hi @ngrmm $list = $pages->get(1234)->children; $toJSON = $list->explode(function ($item) { return [ 'title' => $item->title, 'id' => $item->id, 'tags' => [ 'ids' => $item->page_field->explode('id') ] ]; }); wireEncodeJSON($toJSON);
-
Hi @lpa It depends on how many pages you have in the system. There is a 'rebuildAll' method in the PagesParents class that runs every time you move a page. Take a look at this issue https://github.com/processwire/processwire-issues/issues/1459 You can try to use transactions if you use InnoDB.
-
Can the system 'user' template be used for pages?
Zeka replied to modifiedcontent's topic in General Support
Hi @modifiedcontent It's better to stick to this feature https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-templates-or-parents-for-users -
Searching for "files" on processwire.com breaks the site?
Zeka replied to rastographics's topic in General Support
I have had this issue since the site update, but have never been able to track what is causing it, it's definitely not only 'files'. -
@Abe Cube Which module?
-
Hi @Abe Cube I you are talking about ProcessPageEdit screen, that you can add runtime fields via hook. You can find some info there
-
Sometimes it's hard to see the forest for the trees.
Zeka replied to Chris Bennett's topic in Dev Talk
* - Inputfields.startSpinner(f): Start spinner for Inputfield. * - Inputfields.stopSpinner(f): Stop spinner for Inputfield. -
Sometimes it's hard to see the forest for the trees.
Zeka replied to Chris Bennett's topic in Dev Talk
Hi @Chris Bennett It worth to mention that there is a branch of helpful public methods in Inputfields.js that you can use in such cases https://github.com/processwire/processwire/blob/master/wire/templates-admin/scripts/inputfields.js -
Hi @Frank Schneider Have you enabled urlSegments in template settings for mitglied_edit page?
-
In this way it will generate an image variation and the original image will stay untouched, but as I understood @picaricawant to resize the original image. If so, you can do something like $this->addHookAfter('InputfieldImage::fileAdded', function(HookEvent $event) { $inputfield = $event->object; if ($inputfield->hasField != 'image' && $inputfield->hasField != 'images') return; $image = $event->argumentsByName("pagefile"); $maxSize = 780; $portrait = $image->height > $image->width; $property = $portrait ? 'height' : 'width'; $width = $portrait ? 0 : $maxSize; $height = $portrait ? $maxSize : 0; // if the current size exceeds the max, proceed a resize if ($image->$property >= $maxSize) { $is = new ImageSizer($image->filename, ['quality' => 100]); $done = $is->resize($width, $height); } });
-
Hi @jds43 $page->template->noLang
-
Hi @Juergen Try to set current user language to the langauge that are set for user to which you are sending mail like protected function sendActivationLinkEmail(User $user): bool { $savedLanguage = $this->wire('user')->language; $this->wire('user')->language = $user->language; // send an email with the activation link to the user // but check first if activation code (fl_activation) exists inside the database if($user->fl_activation){ $m = wireMail(); $m->to($user->email); $m->from($this->input_email); $m->subject($this->_('Action required to activate your account')); $m->body($this->createActivationLinkEmail($user)); $m->mailTemplate($this->input_emailTemplate); return $m->send(); } $this->wire('user')->language = $savedLanguage; return false; }
-
Hi @Bike There is Textformatter type of modules that are applicable in such cases. You can take a look at this module https://github.com/Toutouwai/TextformatterProcessImages from @Robin S Probably it can suit your needs or at least you can use it as a staring point.
-
How to prevent backend generating default thumbnail images
Zeka replied to rushy's topic in General Support
Hi @rushy AFAK there is no built-in option. There is a way how you can override core modules https://processwire.com/blog/posts/processwire-core-updates-2.5.14/#multiple-copies-of-the-same-module. After that you can adopt 'getAdminThumb' method so your default image variation will match one that you are using on the frontend. Potentially there could be some issues with admin UI. -
[SOLVED] infinite ajax scroll appends repeat content, same as before
Zeka replied to picarica's topic in General Support
@picarica Does pagination work without infiniti scroll? -
Hi @picarica You can achive it by hooking InputfieldFile::fileAdded like in the example below: $this->wire()->addHookAfter('InputfieldFile::fileAdded', function ($event) { $inputfield = $event->object; if ($inputfield->hasField != 'image' && $inputfield->hasField != 'images') return; $image = $event->argumentsByName("pagefile"); // Main post image if ($inputfield->hasField == 'image' && $inputfield->hasPage && $inputfield->hasPage->template->name == 'post') { $image->size('postMainImageSmall'); $image->size('postMainImageMedium'); $image->size('postMainImageMediumPortrait'); $image->size('postMainImageLarge'); } // Matrix block 'Gallery' if ($inputfield->hasField == 'images' && $inputfield->hasPage && $inputfield->hasPage->repeater_matrix_type == 5 && $inputfield->hasPage->template->name == 'repeater_builder') { $image->size('postBlockGallerySmall'); $image->size('postBlockGalleryMedium'); $image->size('postBlockGalleryLarge'); $image->maxSize(config('imageSizes')['postBlockGalleryLarge']['width'], config('imageSizes')['postBlockGalleryLarge']['width']); } // Matrix block 'Slider' if ($inputfield->hasField == 'images' && $inputfield->hasPage && $inputfield->hasPage->repeater_matrix_type == 6 && $inputfield->hasPage->template->name == 'repeater_builder') { $image->size('postBlockGallerySmall'); $image->size('postBlockGalleryMedium'); $image->size('postBlockGalleryLarge'); $image->maxSize(config('imageSizes')['postBlockSliderLarge']['width'], config('imageSizes')['postBlockSliderLarge']['width']); } // Matrix block 'Image' if ($inputfield->hasField == 'image' && $inputfield->hasPage && $inputfield->hasPage->repeater_matrix_type == 7 && $inputfield->hasPage->template->name == 'repeater_builder') { $image->size('postBlockImageSmall'); $image->size('postBlockImageMedium'); $image->size('postBlockImageLarge'); $image->maxSize(config('imageSizes')['postBlockImageLarge']['width'], config('imageSizes')['postBlockImageLarge']['width']); } });
-
it definitely was php7... something
-
Hi @Jan Romero Yes, I've solved it, but I don't remember what actually was causing this problem. What is your collation / encoding type? Have you tried to set $config->dbCharset = 'utf8mb4';
-
Weekly update – 12 November 2021: Page Autosave + Live Preview
Zeka replied to ryan's topic in News & Announcements
@ryan Autosave is very usefull feaature, but in some sceanrios it would be great to have shortcut key (Ctrl+S) to force page save with saving of scroll positon. Maybe it's possible to implement it, while you are in thisfield? -
Several ways to do it: $page_to_clone = pages(1051); $destination_parent = pages(1016); $new_title = 'Example'; $pages->clone($page_to_clone, $destination_parent, false, [ 'set' => [ 'title' => $new_title, 'name' => '' ] ]); //////////////// wire()->addHookAfter('Pages::cloneReady', function ($event) { $pages = $event->object; $pagesNames = $pages->names(); $oldPage = $event->arguments(0); $newPage = $event->arguments(1); $sanitizer = $this->wire()->sanitizer; $newName = $sanitizer->pageNameTranslate($newPage->get('title')); $newPage->name = $pagesNames->uniquePageName($newName, $newPage->parent); }); //////////////// $page_to_clone = pages(1051); $destination_parent = pages(1016); $new_title = 'Example'; $pages->clone($page_to_clone, $destination_parent, false, [ 'set' => [ 'title' => $new_title, 'name' => $pages->names()->uniquePageName($sanitizer->pageNameTranslate($new_title), $destination_parent) ] ]);
-
Hi @heldercervantes Why just not use Google Analytics for that? https://www.optimizesmart.com/tracking-site-search-get-based-search-engines-google-analytics/ https://www.lovesdata.com/blog/site-search-reports
-
How to replicate this methods and classes with PHP class?
Zeka replied to sam13579's topic in Getting Started
https://github.com/artyuum/HtmlElement https://davidwalsh.name/create-html-elements-php-htmlelement-class