Leaderboard
Popular Content
Showing content with the highest reputation on 01/24/2019 in all areas
-
This looks okay. You just need to get the correct image from the page. For performance reasons, I'd build an intermediate array that groups the images by page, as you have to load each page into memory to retrieve the image. This way, you can uncache the page after you have rebuilt all its variations. Untested: $query = $this->database->prepare('SELECT name FROM FIELDS WHERE TYPE = "FieldtypeImage"'); $query->execute(); $results = $query->fetchAll(); $pageimgdata = []; foreach ($results as $row) { $query = $this->database->prepare('SELECT * FROM FIELD_'.$row[0]); $query->execute(); $images = $query->fetchAll(); foreach($images as $image){ $pageid = $images["pages_id"]; $filename = $images["data"]; if(! isset($pageimgdata[$pageid])) $pageimgdata[$pageid] = []; $pageimgdata[$pageid][] = $filename; } } foreach($pageimgdata as $pageid => $filename) { $p = $this->pages->get($pageid); $PFM = new PagefilesManager($p); foreach($data as $entry) { $img = $PFM->getFile($filename); if($img) $img->removeVariations(); } $PFM = null; if($p != $this->page) $this->pages->uncache($p); // To clear up memory early in case there are a lot of pages }4 points
-
Please be a bit more specific. Why is this so important to you, and how would you envision it being implemented in the context of ProcessWire? Have you considered the possible solutions mentioned in this thread, and if so, what made you decide that they are not good enough? We're always happy to discuss new ideas and suggestions, but on the off chance that you're only posting these things in order to cause an argument, be aware that such behaviour won't be tolerated here. Thanks for giving your posts a bit more consideration from now on, and have a great day!3 points
-
3 points
-
It's not hard to implement yourself. Create a template with a PHP file where you: Parse and sanitize all relevant information from the call (page id, filename, width, height, other options/actions) Retrieve the page with the given id Instantiate a PagefilesManager object with the page as the parameter Retrieve the image by calling getFile on the PagefilesManager Call size() on the image with necessary parameters/options Call $session->redirect() with the url of the object return by the site() call Here's a quick&dirty implementation:3 points
-
I had to do something like this recently. The "include" clause in the selector applies to the whole selector - you cannot have an include clause apply only to one OR-group. So the solution is to use include=hidden outside of the OR-groups, then exclude hidden pages within the OR-groups where you don't want the include=hidden to apply. So the selector for your example above would be: $results = $pages->find("(template=x|y|z, status!=hidden), (template=a), title|body~=$searchquery, include=hidden");2 points
-
It's probably because that module uses: new WireMail() https://github.com/ryancramerdesign/LoginRegister/blob/7e6395393d46f9fba3a6769cc2ce85d4e495b8a4/LoginRegister.module#L677 rather than: wireMail() or $mail->new() Docs here: https://processwire.com/api/ref/wire-mail/ That causes PW to use its core email sending, and prevents wireMailSMTP and other mailing modules from working. I think this is a critical bug in this module which needs attention. Can you please report here: https://github.com/ryancramerdesign/LoginRegister/issues2 points
-
2 points
-
All done. @bernhard I had to modify return false to true to to keep processing other tables in the loop (if any).1 point
-
There are limitations to the number of significant figures that can be stored by the FLOAT column type in the database. There are also precision limitations to how floats are handled in PHP. These are fundamental limitations and PW cannot do anything about them. However it would be good if the PW admin warned the developer about them so people aren't caught out - there is a request for this but it hasn't been actioned yet: https://github.com/processwire/processwire-requests/issues/173 Best to use the Decimal fieldtype in cases where the limitations of the Float fieldtype are a problem.1 point
-
@adrian: I reportet this allready on github. I will also report @BitPoets change.1 point
-
@BitPoet: Yes you are right and yes, adding this line solved the issue also with the regular WireMail.1 point
-
@pout: even the regular WireMail class shouldn't cause such problems, so it would be good if we could narrow the cause down. Could you check if the issue is still there if you add the following line after the one @adrian linked to: $mail->set("newline", "\n");1 point
-
Thanks! Using wireMail() instead of new WireMail() in line 677 made use of WireMailSmtp and this solved the other issues. I will post a bug report.1 point
-
1 point
-
1 point
-
Hi Torsden, try to use ProcessPageEdit::buildForm, do a google search for this exact phrase and see if you can get examples. Sorry, on mobile ? The principle is to get the right field in the hook and then just change the "required" setting.1 point
-
https://processwire.com/docs/start/install/troubleshooting/ You should take care of the fatal error first, to get it running again. size() is used for images. Make sure that all your files were transferred when you moved to another server. Make sure the CHMOD settings are valid/identical. Can you at least login to the backend? If so, install Tracy Debugger, which will give you further infos + tools for debugging.1 point
-
Yet another solution: use AdminOnSteroids See the bottom of this screenshot: https://camo.githubusercontent.com/4adc7e92ce6a8323b0d29dcd8b888a48e7eb3820/68747470733a2f2f726f6c616e64746f74682e68752f7069632f616f732f616f733136342e706e671 point
-
1 point
-
I use the following method with success, in your module: public function init() { // add a hook after each page is rendered and modify the output $this->addHookAfter('Page::render', $this, 'page_after_render'); } public function page_after_render($event) { /** @var Page $page */ $page = $event->object; if( $page->template =='admin' ){ $head_include ='<link rel="stylesheet" type="text/css" href="PATH/TO/YOUR/CSS" /> '; $replace = array( '</head>' => $head_include .'</head>' ); $event->return = str_replace( array_keys( $replace ), array_values( $replace ), $event->return ); } } Pretty simple and $replace array can be extended as needed.1 point
-
If you want to load your CSS/JS assets last in the <head> then see this approach too:1 point
-
It should totally work, but i think you need to rename your assets, remove the Pro and then it will work, also remove the PPLP from the Activate for process.1 point
-
I have already mentioned this in the comment section of the very first blogpost of Ryan showcasing it. Luckily I use the Dark Reader chrome extension to browse most sites anyway, but it would be nice to see a lot less contrast. Better yet, a native dark mode for the site would be welcome. We have just been presented with a nice example: https://processwire.com/talk/topic/20584-schwarzdesign/ (click the sun icon of the site in the top right corner).1 point
-
The new rockfinder updates make it easy to extend grids: Extending Grids Sometimes several RockGrids are very similar and you don't want to duplicate your code. You can create one base file and include this file from others: // trainings.php $finder = new RockFinder([ 'template' => 'training', 'sort' => 'from', ], [ 'first', 'from', 'to', ]); $finder->addField('coach', ['title']); $finder->addField('client', ['fullname']); // trainings_booked.php include(__DIR__.'/trainings.php'); $finder->setSelectorValue('client', $this->user); // only show trainings of current user $finder->addField('done'); // add column to show if the training was completed $this->setData($finder); You can then create another file, for example trainings_available.php to show all trainings that are in the future and available for booking: include(__DIR__.'/trainings.php'); $finder->setSelectorValue('from>', time()); $finder->setSelectorValue('client', null); // client must not be set -> means available for booking $this->setData($finder);1 point
-
Yes, it iterates the page's assets directory, checks every file if it is a variation of the current image and, if yes, recreates it with the constraints encoded in the variation's filename.1 point
-
I think the best explanation is directly above that method: So, as I understand this, it tries to rebuild variations. But limited variations, 0 = without suffixes, without crops, etc. (read on above). But to know which variations are belong to an image, the variations have to exist! (It gets all variations and then try to determine how they were build, what seems to be simple for mode = 0, but becomes more and more special and indefferent with higher modes). HTH ?1 point
-
Wasn't aware of that - but found the blog post: https://processwire.com/blog/posts/processwires-roadmap-in-2015/ 1 hour ago, adrian said: The advantages of using this _OR_ syntax are explained in this blog post: https://processwire.com/blog/posts/processwire-3.0.40-core-updates/#getting-one-field-or-another-from-a-page1 point
-
i incorporated those elements, so those are in the module now; Should be tested by someone though, eu region on the forked version. https://github.com/outflux3/WireMailMailgun/blob/master/WireMailMailgunConfig.php#L18-L27 https://github.com/outflux3/WireMailMailgun/blob/master/WireMailMailgun.module#L197-L2051 point
-
I'd planned on writing up a blog post today and bumping the PW version up to 3.0.125, but working on documentation pages ended up taking up most of the day. My hands are getting a bit tired from all the writing, so I'll keep this post short. ? I'll have a more formal post with more on the 3.0.125 version next week. People have been asking for more information on the various ProcessWire API access methods, as well as more information on the Functions API. I've written up a new documentation page that covers all the details. Though it's become a bit long, so next week I might split off the Functions API part into a separate child page. But for now, this is what I've got—the new documentation page is located here: https://processwire.com/docs/start/api-access/ In addition, the ProcessWire API Explorer module has been updated to support documentation for ProcessWire's procedural functions this week. And as a result, our online API documentation page now covers them all too. I spiffed up the phpdoc on all of them (and in some cases re-wrote the content) in preparation for that. For those that were asking for more documentation on the API functions, this page also has a section dedicated for those. Here's a direct link to our more than 50 procedural functions available in PW that previously didn't have any online documentation: https://processwire.com/api/ref/functions/1 point
-
I don't think there's an inbuilt method for that, but you can quickly built your own! For the excerpt, you just need to find the first occurance of the search term inside the field you're searching, then display the text around that. A quick example: // get the search term from the GET-parameter and sanitize it $term = $sanitizer->text($input->get->q); // how many characters to include before and after the search term $include_around = 50; foreach ($pages->find('body~={$term}') as $result) { echo '<h2>' . $result->title . '</h2>'; // start and end positions of the search result in the body field $term_start = mb_strpos($result->body, $term); $term_end = $term_start + mb_strlen($term); // where to start and end the output, and additional // checks to make sure it's not out of bounds $offset_start = $term_start - $include_around; if ($offset_start < 0) $offset_start = 0; $offset_end = $term_end + $include_around; if ($offset_end > mb_strlen($result->body)) $offset_end = mb_strlen($result->body); $output = mb_substr($result->body, $offset_start, $term_start); $output .= '<mark>' . $result . '</mark>'; $output .= mb_substr($result->body, $term_end, $offset_end); echo '<p>… ' . $output . ' …</p>'; } I don't have a ProcessWire installation to test this right now, so might be some errors in there, but you get the idea ^^ Basically, find the term inside the field you're searching, then include some characters before and after it for context, and wrap the search term in <mark> tags for highlighting (you can also add a CSS class to target the search result for styling). You can of course refine this as much as you want, for example you can check for full stops to include complete sentences; you'll also want to make sure to find matches in the title as well, and in this case maybe only display the first X characters of the body ...1 point
-
1 point
-
Hi there, we are a small Communication Agency in Munich and we are searching for a Processwire Developer. A lot of our Online Projects are based on Processwire and our current Developer is switching from Freelance to a full term job. The work can be done remotely from anywhere. For more Informations please contact me directly via Email: p.kirschvink@damego.de Looking forward to hear from you. Best Paul1 point
-
Hello Jozsef, for the generation of many large image variations, ImageMagick comes in handy. Of course you have to enable it first on your webspace, but most hosters have an manual for the activation, if they support it. Usually I visit the page I added images in to generate the variations. You could probably achieve this also by an hook. But for me it seems more natural to check the changes I made after saving a page. For the lazy loading of images in the front end, I can highly recommend using the plugin lazysizes. It is easy to setup, supports responsive images, background images and so on. There is also the module Markup SrcSet, which uses lazysizes. Regards, Andreas1 point
-
I was unable to hook to this page, so ended up creating a custom admin page to support a button to export users via CSV. Seems overkill, and I'm sure there are other senarios which may warrant additional buttons such as: Selecting all users for another operation (copy to clipboard) or email all users etc. It would be nice to find out the appropriate method to hook to1 point
-
Place the below in your /site/config.php // Honour goes to Raymond Geerts for the idea ! $config->templates = array( 'dev.foobar.com' => 'devtemplate', // domain => templates folder name ); if (isset($_SERVER['HTTP_HOST']) && isset($config->templates[$_SERVER['HTTP_HOST']], $config->templates)) { foreach ($config->templates as $host => $folder) { if ($_SERVER['HTTP_HOST'] === $host) { // set new paths $config->urls->templates = "/site/" . $folder . "/"; $config->paths->templates = dirname(__DIR__) . $config->urls->templates; break; } } }1 point