Leaderboard
Popular Content
Showing content with the highest reputation on 04/11/2020 in all areas
-
Last week I posted in the blog about current projects in progress, and consistent with that, this week I’ve been working primarily on the upgrades to our file/image fields. To start, this focuses on storing additional info in the DB table, including file size, created/modified user info, and for image fields: width and height. This is useful in making these properties searchable from page-finding selectors, but also a necessary pre-requisite to supporting external file systems. A “ratio” floating point property is now available on image fields as well (and also stored in the DB) and this value reflects the width divided by the height. This is a searchable property and will be useful for quickly finding portrait images, landscape images, square images, or any proportion you need to find. If you want to find images that are at least twice as wide as they are tall, then you’d be looking for a “ratio” of 2.0 or larger (“ratio>=2”). If you needed to find perfectly square images (i.e. 300x300) then you’d be looking for a ratio of 1.0. If you needed to find portrait images, then you’d be looking for images with a ratio under 1.0 (or twice as tall as wide would be 0.5). You can figure out what ratio you are looking for just by taking your target width and dividing by your target height. Longer term, combined with the other added properties, the goal is that this will help with finding pages that have images suitable for specific placements, proportions and dimensions. These new properties won’t be useful at first on existing sites because the data just isn’t present in the DB, even if the columns to store them are. They are populated over time whenever the page is saved. But I’m going to enable an option to have it populate all of this automatically whenever the field is even loaded. It’s actually there in the core right now, but I’ve got it disabled so I can test it out on a few more of my installations before others start using it. There were some other upgrades to the core as well, including improvements to the Selector and Selectors classes, addition of a $database->columnExists() method, lots of new (mostly internal) methods in FIeldtypeFile/FieldtypeImage, and some refactoring of the FieldtypeMulti class, among other minor updates. While there were a lot of changes and additions this week, it’s not stuff that you’ll likely be using right away, so I’m going to hold off on bumping the version till next week. Thanks for reading and have a great weekend!9 points
-
@Robin S Thanks for confirming that! I submitted an issue and a PR I’m not too sure about. https://github.com/processwire/processwire-issues/issues/11433 points
-
I think you should open an issue for this at GitHub. In WireShutdown the combination of... // use text-only output if an http request that is ajax if($useHTML && $config->ajax) $useHTML = false; ...and... } else if(!$useHTML) { $why = $this->labels['cli-mode']; } ...means that every AJAX request is wrongly treated as being CLI mode.3 points
-
Is my 100th post I wanted to do something special. I edited a video, hope you like it Just for fun Edited: Now with subtitles2 points
-
Hey Ryan — just wanted to say thanks. Assuming that I've got this right and this could mean that eventually ProcessWire can natively (or at least with a module that doesn't have to rely on any weird tricks) support something like S3 or Google Cloud Storage, this is a brilliant move! Very much looking forward to that. Thanks again, and keep up the great work ?2 points
-
Hi Ryan, as always great to hear about the progress ? I have no idea how that will work internally, but this sounds like it might be a good time to also think about having a setting for a custom storage path in core file fields. Maybe that will be possible anyhow by default (like providing an external file system driver that actually stores files on the local file system). But if not this would be a huge improvement in many cases: File fields in module config File uploads with custom storage path in processModules Maybe having a file field on multiple pages sharing one single storage location (like a global gallery) Thx ?2 points
-
But ProcessWire’s WireShutdown class considers everything hitting it with X-Requested-With: XMLHttpRequest to be CLI use. The way I see it, from a security perspective that makes the differentiation between public and detailed error messages completely useless: if you’re shown the public error, you can just resend the request with the header and any PW installation will gladly tell all. It kinda didn’t occur to me to even look through the source, because I figured something like this would have a prominent setting somewhere, but now I think it just might be a bug? WireShutdown does this: $useHTML = isset($_SERVER['HTTP_HOST']); // is this an HTTP request where we can output HTML? […] // use text-only output if an http request that is ajax if($useHTML && $config->ajax) $useHTML = false; […] if($config->debug) { $why = $this->labels['debug-mode'] . " (\$config->debug = true; => /site/config.php)."; } else if(!$useHTML) { $why = $this->labels['cli-mode']; } […] if($why) { $why = $this->labels['shown-because'] . " $why $who"; $message = $this->amendErrorMessage($message); $this->sendErrorMessage($message, $why, $useHTML); } else { $this->sendFatalError($who, $useHTML); } So for this purpose, sending two headers in your request is essentially equivalent to the site being in debug mode. That can’t be right?2 points
-
The title might sound more exciting that it actually is. It's just a little helper module to keep things organized ? Basically it just saves you from finding the correct require_once("where/is/my/nette?") and, for a little extra security, it adds an .htaccess file to block all direct access to Nette source files. Why? Nette is an awesome framework with some awesome features/utilities that ProcessWire lacks. Creating separate modules and including Nette packages multiple times in those modules would not be efficient. RockNette makes it easy to store them in a central place. Usage You'll get all necessary instructions on the module information screen: https://github.com/BernhardBaumrock/RockNette1 point
-
--- There might be some changes to this module in the near future! Please see this comment --- I guess we have all been there... We need to store a price to a product. "Ok, easy, let's create a new field for that in the PW backend!" might be the first thought. But then the headache starts... What about TAX? What about NET and GROSS values? And what about rounding problems when not using the correct float or decimal values ( https://processwire.com/talk/topic/7542-development-fieldtypefloat-fieldtypedecimal/ )? Meet RockPrice - a brand new (and not well tested!) module to save you from those headaches and make the UI more compact and reactive (nobody wants to calc tax/net/gross manually!). If you discover any issues or have suggestions for improvement please let me know! ? --- Download: https://github.com/BernhardBaumrock/RockPrice --- RockPrice Price Fieldtype + Inputfield for ProcessWire CMS Settings Usage The field always returns a RockPriceMulti object. This object contains an array of items and the totals vor vat, net and gross (where tax stands for the tax rate in percent and vat for the actual tax value, eg. Euros or Dollars): d($page->price); d($page->price->items->first()); API Saving field value: $page->setAndSave('price', [1000, 20]); $page->setAndSave('price', [ [1000, 20], [3000, 10], ]); Comparisons $p1 = new RockPrice(1000, 20); $p2 = new RockPrice(1000, 10); d($p1->equals($p2)); // false $m1 = new RockPriceMulti([$p1, $p2]); $m2 = new RockPriceMulti([$p1, $p2]); $m3 = new RockPriceMulti([$p2, $p1]); // flipped! d($m1->equals($m2)); // true d($m1->equals($m3)); // false d($m1->equals($m3, true)); // true (ignoring sort order)1 point
-
Aiming to do this this weekend. I had another question. Is it possible to configure whether the inputfields for Import and Export are added to the bottom or the top of the PageTable? It currently does this: $inputfields->add($fieldset); return $event->return .= $inputfields->render(); Which simply concats it to the end, but I wonder if there's an alternative? If the PageTable gets long having to scroll to bottom for the Import/Export isn't fun so maybe a configurable option?1 point
-
An easier way to set the status code: http_response_code(303); Available since PHP 5.4.1 point
-
In case anyone else hates it when websites do that, set these to false in Firefox about:config: layout.css.scrollbar-color.enabled layout.css.scrollbar-width.enabled And perhaps this one to true: widget.disable-dark-scrollbar1 point
-
Actually you can directly use the $session->redirect() method for sending any 30X status code, by taking advantage of its second parameter 'http301'. When this parameter is set to false, ProcessWire uses PHP default behavior regarding location headers (PHP Manual says: […] "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless the 201 or a 3xx status code has already been set.) Therefore, to send a 303 status code, you can simply write: header("HTTP/1.1 303 See Other"); $session->redirect ($someUrl, /*$http301=*/false);1 point
-
Goldkinder Psychotherapie Website of the child and youth psychotherapist Heike Maßen from Mönchengladbach, Germany. A one-pager that gives an insight into her work and her practice rooms, as well as information about many relevant aspects. It's a simple responsive one-pager with a nice design from Uta Hugenbruch. The front end is build without any framework.1 point
-
1 point
-
I also had the same trouble with strategy 2. So I switched to strategy 3, wich is a little more effort but better in my opinion. ? Regards, Andreas1 point
-
Thanks @tpr for the static variable and "cache" approaches. I believe that after reading the @teppo detailed instructions about the different approaches, I would start using the <picture></picture> approach for new sites, however would give another try to the automatic webp conversions through .htaccess and code calls in the instructions. I have no doubt that in the next one or two versions, Apple would be having already the WEBP implemented which would simplify the things, however until then, it is good to know the best practices and most important, which way works best for us and users. Since my profile is fully completed but it is not yet live since I am adding the content now, it won't hurt me to try all the kindly suggested approaches and see for myself which one to keep. Btw, HAVE AN AMAZING AND PRODUCTIVE 2020 YEAR!1 point
-
Hi guys, so since I moved to Processwire, it has been my default go-to CMF/CMS for my website and client applications, apparently my previous job took a toll on me, and made me have less time, but now finally had the chance to change my website to something I always had in mind. I decided to go with something minimal, as I tend to enjoy writing, so wanted a website to have more text than graphics and I think I whipped up something clean. Currently I still have more to do, but this is my current website, the main purpose to have a content driven website where I will be writing tutorials , articles more and hopefully technical notes. Please let me know your honest opinion. PS: I am more of a coder than a designer but i think this old dog still pulled it off https://okeowoaderemi.com/1 point
-
We had the opportunity and pleasure to create a multi-site with ProcessWire. The Walter Group consists of four investment units, each with its own domain name(s). Thus, six domain names with two different language negotiation strategies had to be managed by a single installation. The four sites more or less share news, staff and other information. waltergroup.ca (in English) and groupewalter.ca (in French) walterfinancial.ca (in English) and financierewalter.ca (in French) waltercapital.ca/en and /fr walter-gam.com/en and /fr The Multisite module was designed to meet the challenge. A tree structure has been created with the four units, with news and management staff pages placed outside these sites so that they can be more easily managed by Walter Group. We also used FormBuilder for the four contact forms whose entries had to be directed to different people. The result really pleased the Walter group, long used to complicated CMS!1 point
-
When the need is there for separate DB configurations and something more than config-dev.php, I've done it like this in my /site/config.php file: switch($_SERVER['SERVER_NAME']) { case 'localhost': // set database settings for localhost break; case 'dev.domain.com': // set database settings for staging server break; default: // set database settings for production server } You should give preference to SERVER_NAME in this case (over HTTP_HOST) just because HTTP_HOST is coming from the client rather than the server (open to tampering). Though it doesn't really matter as long as your last "default" condition assumes the production server.1 point
-
I've been meaning to upgrade the caching options in the templates editor. It's easy to do, so I went ahead and put it in place and it's now committed to the source. Now you can choose any of these cache clearing options: When page is saved: Clear the page's cache (default) Clear the entire site's cache Clear the page's cache and it's parents (including homepage) Clear specific pages (with page list selection) Don't clear anything Attached is a screenshot with the #4 option selected. In ProcessWire, using the cache is definitely not required. I leave it off for smaller or lower traffic sites, and then use it only on some templates with higher traffic sites. But now that there are more clearing options, I may start using it a lot more. But my goal is always to keep ProcessWire fast whether you have the cache turned on or not. But there's no doubt that caching can make a big difference on pages where you are performing heavy operations.1 point