-
Posts
4,085 -
Joined
-
Last visited
-
Days Won
87
Everything posted by horst
-
Hey @benbyf, I believe I'm not of much help. ? Me seems to be just another dinosaurs setup. ? IDE: Nusphere PhpEd PW Modules always: Admin DEV Mode Colors | ALIF - Admin Links In Frontend | Cronjob Database Backup | Process Database Backups | Login Notifier | User Activity | ProCache I develop on local https hosts (via Laragon on Windows); Where possible, I use Staging on subdomains of the (clients) LIVE server, as this mostly is the exact same environment setup like on LIVE; Sync & migration between all installations with Beyond Compare and the PW Database Backup Module, and/or the remote-files-on-demand hook from Ryan; Only very rare I directly work on STAGE via PhpED (SSH, SFTP), and afterwards pull it down to local; That's it. ?
- 66 replies
-
- 4
-
-
-
- developing
- working with pw
-
(and 1 more)
Tagged with:
-
@DrQuincy what is this page doing that takes a lot of time? If there is a loop operation that iterates over a lot of items, and you are able to implement an optional get param with the last processed item identifier, there is a good chance that this is all you need to do to make this work. For this to work you would check if a start-identifier was given with the URL, if not start with the first item, otherwise with the #n item from the $input->get->myidentifiername. When starting the script, store a timestamp and in each loop operation compare it with the current timestamp. Maybe when it reached the point greater or equal 100 seconds, do a redirect call to the same page, but with the current (last) processed loop item identifier: ... if(time() >= $starttimestamp + 100) { $session->redirect($page->url . '?itemidentifiername=' . $lastProcessedItemID); } ... Or, much easier, have you tested if the 120 second time limit can be reset from within a script? (calling set_time_limit(120) from within a loop can make it run endless on some server configurations)
-
@Didjee I think this must be an issue with the core. But I'm not able to investigate further ATM. Maybe there is a possible workaround, or at least some (micro) optimization, with your code example, leaving out the subfile class(es) from the chain. If you have enabled the $config->webpOptions['useSrcExt'], you can globally enable the creation of webP variations in the base core image engines, directly when creating any jpeg or png variation, by setting $config->imageSizerOptions['webpAdd'] to true. But this can result into a lot of unwanted webP files from intermediate image variations (that are never shown to the front end, but only are variation steps in the building chain)! Therefore better globally leave this setting to false, but pass an individual options array into any image sizer method where appropriate (width(123, $options), height(123, $options), size(123, 456, $options)) with this enabled. Example: <?php // this create a jpeg AND a webp varition with 900px for the 2x parts $imageX2 = $page->image->getCrop('default')->width(900, ['webpAdd' => true]); // this reduces the 2x variation to the half size for 1x, (jpeg AND webp at once) $imageX1 = $imageX2->width(450, ['webpAdd' => true]); // now, as you have set $config->webpOptions['useSrcExt'] to true, // every webp variation simply has to get a trailing ".webp" to the jpeg URL: ?> <source type="image/webp" srcset="<?= $imageX1->url . '.webp' ?> 1x, <?= $imageX2->url . '.webp' ?> 2x"> <source type="image/jpeg" srcset="<?= $imageX1->url ?> 1x, <?= $imageX2->url; ?> 2x"> Given that the issue you encountered is located in the files / images sub module for webp, the auto refresh now should be working, as you use the older, (but clumpsy) method in the base imagesizer engine. Have not tested this for quite a few (master)versions, but hopefully it is still true. ? PS: De hartelijke groeten aan de naburige stad! ?
-
I do not understand. I asked for the field type of mitglied_kategorie.
-
How do you add the category to the member pages? Through which type of field? Options Select, Page Reference, ...?
-
@Abe Cube please use the code input to post code: Example: <?php namespace ProcessWire; class TabExtension extends WireData implements Module { public static function getModuleInfo() { return [ 'title' => 'Foo test module', 'summary' => 'An example of creating a module', 'version' => 1, 'summary' => 'Display message when pages are saved', 'autoload' => true, ]; } public function ready() { $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addButtons'); } public function addButtons($event) { $page = $event->object->getPage(); if ($page->template == "bewerbung") { $form = $event->return; $inputfields = new InputfieldWrapper(); $tab = new InputfieldWrapper(); $tab->attr('title', 'Settings'); $tab->attr('class', 'WireTab'); $markup = $this->modules->get('InputfieldMarkup'); $markup->label = 'Settings'; $markup->value = '<p>Just a placeholder for some inputfields.</p>'; $tab->add($markup); $inputfields->add($tab); $form->add($inputfields); } } }
-
Manually sorted images revert to previous order on save
horst replied to BillH's topic in General Support
@BillH You may have a look into the DBs table of an image field and check what numbers are set in the column "sort" before and after you opened, changed and saved or reopened a special page. If you have no DB viewer app at hand, you also can use a little debug script (cli script) to check this. Example script for CLI access, given the images field is named "images" and the page id of one problematic page is "1234": <?php namespace ProcessWire; include('./index.php'); $tablename = 'field_images'; $pages_id = 1234; echo '<pre>'; $query = "SELECT data, sort FROM {$tablename} WHERE pages_id={$pages_id}"; $pDOStatement = $database->query($query); foreach($pDOStatement as $row) { echo "\n{$row['sort']} :: {$row['data']}"; } echo "\n\nReady!"; exit(0); You may check if all image entries have a value in the column "sort", if it is a valid value, starting from 0 and is up counting, if it changes and when, etc. This may help a bit on coming closer to the issue. Do the older pages use the same images field and also the same template then the newer pages? If not, are there different per template settings for the images field? ... -
Extending inputfield without creating new one
horst replied to Richard Jedlička's topic in Module/Plugin Development
textformatter module -
Hi @teppo, I'm not able to react quickly to this. I will try to investigate and / or set up an in-depth-test for that issue and want to take in some of the images where @bernhard and / or @Robin S solutions worked fine. Just trying to get a new working solution for all situations. But I only can schedule this after the 22. december, unfortunately not earlier. ? @teppoCan you PM me a zip with the wrong original image, and maybe one corrected from PW, or only the original image and what you have changed in the code so that it comes out correctly?
-
How do I link to a page with a language in a multilingual website?
horst replied to kaz's topic in General Support
Does this behave the same with internal (relative) links and external (httpUrl) links? Haven't tried, just a thought. -
Wrong redirection for page with name that equals language root name
horst replied to gebeer's topic in Multi-Language Support
Hi @gebeer, Not really knowing an answer, but first I would post this in github issues so that it gets ryans recognition. And one idea came to my mind as workaround until a solid solution is known, would it be possible to use in pw the /cn/asia/... structure and use apache mod_rewrite to make it read /cn/cn/... ? Have not tried, just an idea. -
Selector weirdness when searched value has zeroes and dots
horst replied to MSP01's topic in General Support
It looks like the numeric chars aren't seen as text but as number and gets cleaned up like trailing zeros in decimal sector have no meaning. So I bet if you have something like 7.50000 it comes out as 7.5 but 7.50001 will come out as 7.50001. I'm not sure if this sort of clean up (sanitizing) is done by PW or by MySQL. ?? -
Selector weirdness when searched value has zeroes and dots
horst replied to MSP01's topic in General Support
Have you also tried it with the $sanitizer->selectorValue()? Does it behave the same or different? -
How to prevent backend generating default thumbnail images
horst replied to rushy's topic in General Support
Hi @rushy, you also first may try to set the $config->adminThumbOptions in a way that matches already existing image variations: Above are the default settings from the wire/config.php. Use this as starting point and copy it into your site/config.php and adjust as needed. -
Nice site! I'm thinking if it would be a good idea to spent the Especialidades main menu point some sort of dropdown with all subpages listet?
-
Most optimal place to store built assets?
horst replied to Jonathan Lahijani's topic in General Support
As the name says: built assets ? -
The PHP function substr() can be used to start after the 4. character. You can use it in your template file or create a little textformatter module. (Sorry im on mobile, no link to the PHP manual provided.)
-
Sharing authorization between ProcessWire installations
horst replied to Ivan Gretsky's topic in General Support
I want to have a copy, if I can. ? ? -
Loading time optimisation with lots of images
horst replied to michelangelo's topic in General Support
the following is a transparent 1 px gif: <img src='data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' ... If you use this as default src, together with the width and height attributes, the browser engine is much earlier ready (doc-ready). You ommit one extra server request per image, as the images default data is already available within the HTML. And the default data is thousand times smaller this way. All that speed up things drastically. To your other points: 2) As I understand the concept of srcset, you should use / load the smallest fit, and if the image should be zoomed / scaled up afterwards, the browser handles additional (re)loadings. -
If I remember right, in such cases I use a URL field for external URLs and a page select field for internal (multilanguage) links. If the URL field is empty, the page select field is shown, if a (external) URL is given, the page select field is hidden (showIf). (In the notes of the URL field is a hint that clearing the field will show the internal page select field). In template files I first check if there is given a URL or if that is field empty, and according to that I display external or internal URL.
-
Loading time optimisation with lots of images
horst replied to michelangelo's topic in General Support
<img loading="lazy" src="https://comeinyourewelcome.nl/site/assets/files/1150/schermafbeelding_2021-09-28_om_00_35_23.320x0.png" srcset="https://comeinyourewelcome.nl/site/assets/files/1150/schermafbeelding_2021-09-28_om_00_35_23.320x0.png 320w, https://comeinyourewelcome.nl/site/assets/files/1150/schermafbeelding_2021-09-28_om_00_35_23.480x0.png 480w, https://comeinyourewelcome.nl/site/assets/files/1150/schermafbeelding_2021-09-28_om_00_35_23.768x0.png 768w, https://comeinyourewelcome.nl/site/assets/files/1150/schermafbeelding_2021-09-28_om_00_35_23.1240x0.png 1240w, https://comeinyourewelcome.nl/site/assets/files/1150/schermafbeelding_2021-09-28_om_00_35_23.1800x0.png 1800w" sizes="100vw" alt="Image from Untitled by Allen & Overy" width="320px" height="485px" > This is your code from the static HTML. When I look into the browser inspector, all your images for 320w are loading highres images around 2.500 px width and more. ?? What looks not good to me is sizes="100vw" ?? I would expect something like sizes="auto". Also you uses PNG. Why not JPEG or WEBP? Loading 5MB per image also on small browser sizes. Uuups! The above was inspected with disabled javascript. So after correcting the base markup you also need to inspect what the JS does afterwards. Further optimization could be: Using a small data-image as default, like a 1px transparent gif or are more individual one in JPEG or PNG: src="data:image/jpeg;base64,... ... ..." -
Yes, you should turn on debug in your site/config.php for that: $config->debug = true; So, an error logging is always running, but with $config->debug set to true, it is more verbose. All generated log files are located under /site/assets/logs/ and you can view them paginated in the admin under setup > logs > Don't forget to revert $config->debug back to false, if the site is public online! EDIT: If you would have changed the admin thumb size after you have added the 500 to one page, then the page editor would try to regenerate all thumbs at all. (just a possibility, but you haven't changed it, I believe) I'm interested what you will find out. I have pages also with 300+ 400+ and a view with 500 images in one field, but all of them have lesser (longer) PHP timeout restrictions.
-
SSL error when loading files on demand (certificate verify failed)
horst replied to bernhard's topic in General Support
It works for me on windows too. (The image file is a PNG with file ending jpg, but the download succeeds without any issue.)