Leaderboard
Popular Content
Showing content with the highest reputation on 03/05/2021 in all areas
-
ProcessWire 3.0.173 adds several new requested features and this post focuses on one of my favorites: the ability to hook into and handle ProcessWire URLs, independent of pages— https://processwire.com/blog/posts/pw-3.0.173/16 points
-
Herzzentrum Bonn The Herzzentrum Bonn (Heart Center Bonn) is part of the University Hospital Bonn (UKB) and consists of the cardiology and heart chirurgy clinics. Goals for the website were a clear content structure, friendly and personal communication tailored to the different visitor groups and easier maintenance and content updates. Concept, design and implementation by schwarzdesign. www.herzzentrum-bonn.de You can read more about the challenges, concept and implementation of this project in the case study on our website (German only). Notable modules used ProFields (especially RepeaterMatrix) FormBuilder ProCache UniqueImageVariations WireMailSmtp ProcessCacheControl ProcessRedirects TracyDebugger Development insights One thing to note is the central management of staff members. To represent staff members as well as the hiarchies and different departments, we created a layered template structure: person – Represents a single person and has fields for name, title, position, portrait, contact info etc. hierarchy – Represents a hiarchy level or department in the organisational structure. Has person pages as children. people – This is a singleton template which displays all team members sorted by hierarchy level. Has hierarchy pages as children. The central staff database is also used to display people throughout the site – for example, the experts on angiology on the angiology page. Most of the editorial content is created through a RepeaterMatrix field with different section types. The section type for people contains a simple page reference field, allowing the editor to select the people to display in a given context while still being able to edit their contact info in a central place. Another interesting content type are the track records on the homepage. Those are implemented using CountUp.js and a custom IntersectionObserver script to trigger the animation as soon as the section comes into view. Finally, we built a very flexible grid section which uses CSS grid to display grids with variable contents and row/column spans (see an example here). Screenshots6 points
-
I'm getting a look at this thread linked from the PW Weekly, where it looks like this topic has been discussed. BitPoet has an example where named arguments are in the format like "{user}" (if I understood it correctly) and I really like that. It would provide for an option to have named arguments without having to specify what would be in it... just "any valid PW page name characters". That sounds useful. I'll add support for it, in addition to the named arguments support mentioned in the blog post. We can support that without interfering with other regular expression features by having it convert that to a PCRE capture group.5 points
-
RockCalculator Add a calculator to any Inputfield in the ProcessWire backend. Setup At the moment there is no UI for defining fields that should support the calculator. You have multiple options: Tracy Console // show rockcalculator and round result to .00 $field = $fields->get('yourfieldname'); $field->set('rockcalculator', 2); // 2 digit precision $field->save(); RockMigrations $rm->setFieldData('yourfield', ['rockcalculator' => 2]); Hook buildForm $wire->addHookAfter("ProcessPageEdit::buildForm", function($event) { $form = $event->return; $page = $event->process->getPage(); // edited page if($page->template !== 'yourpagetemplate') return; if($f = $form->get('yourfield1')) $f->rockcalculator = 2; if($f = $form->get('yourfield2')) $f->rockcalculator = 2; if($f = $form->get('yourfield3')) $f->rockcalculator = 2; }); Github: https://github.com/baumrock/RockCalculator Modules directory: https://processwire.com/modules/rock-calculator/3 points
-
Great addition!! Kudos to @bernhard for bringing this on board!2 points
-
ProcessCacheControl version 1.1.0 released I just released an updated version of this module which fixes some issues with the asset version management feature. In particular: When using CacheControlTools::getAssetVersion while no asset version existed (for the specified category), the implicitly generated version incorrectly expired after one day. This is now fixed, so asset versions will not expirate anymore until manually cleared. Asset versions are no stored using WireCache::expireNever instead of WireCache::expireReserved. This means they will be deleted when using $cache->deleteAll(), when previously you had to explicity specify them by namespace to clear the cached versions. Links: Full changelog for version 1.1.0 ProcessCacheControl in the modules directory2 points
-
Hi everyone, I'm not an expert, but I regularly make small to medium-sized pages either in static html or for wordpress (_s). I now use Processwire instead of creating static pages, because I can then maintain the pages more easily and I am also faster. I created a site profile with, which is the basis for my work. Since I like to work with sass, I use the sassify module and have created a small boiler for it. html-bones is my html base. And for this I have built in the osano cookie consent. Maybe someone can still use something of it, or there are suggestions for improvement. In fact, i am certainly not using every possibilities of processwire in the best effectivly way, but this basis is sufficient for the type of internet pages that i usually create. I usually don't accept more complex jobs at all, so as not to overwhelm myself. You can find the link to this profile here: https://github.com/eversthomas/processwire/tree/master/site-html5blank-sass And an example: https://processwire.end-linkage.de/ Greetz from germany Tom.1 point
-
Love the new URL hooks! The post doesn't mention what happens when a hooked URL or regex matches an existing page URL, but on testing it looks like the page URL takes precedence. That makes sense. In the blog post there are examples where trailing slashes are present and absent, and tests seem to show that the hooked URLs work regardless of whether a trailing slash is present or absent in the requested URL. But what if you want to enforce a trailing slash or no trailing slash and redirect accordingly as per real page URLs?1 point
-
1 point
-
Hi @adrian, I've got another small issue between TracyDebugger and one of my modules. Not sure if the problem is Tracy, my module or the core, anyway ... The problem is my ProcessCacheControl module, which comes with two module files: ProcessCacheControl itself, which is a Process module, and the helper module CacheControlTools, which implements the Module interface but extends Wire (instead of WireData). When dumping an instance of the CacheControlTools module, I get a fatal exception: Steps to reproduce: Install ProcessCacheControl In the console or any template, try to dump an instance of the module using d / bd: d($modules->get('CacheControlTools')); The stack trace indicates TD.php#L281 as the cause. Specifically, $var->get('title|name') results in Wire->__callUnknown which results in the error above (see attached screenshot). I guess the debugger assumes that the module extend WireData instead of Wire? If I change the module to extend WireData, the exception goes away. Though I would like to keep it extending Wire, since that module doesn't hold any data or state, so extending WireData doesn't make any sense. Maybe this could be handled by Tracy? Thanks!1 point
-
Thanks @adrian! Sorry I forgot to mention the versions ^^ The site I ran into this problem is still on PHP 7.4, but the update fixed the problem nonetheless. Thanks for the quick response!1 point
-
Hi @MoritzLost - I assume you are using PHP8? This used to be OK on PHP7, but 8 seems to have become more strict about blank vs zero. It should be fixed in the latest version.1 point
-
Thx RobinS for the idea about the getExtraMarkup hook! I slightly changed your version: $this->addHookBefore('AdminTheme::getExtraMarkup', function (HookEvent $event) { $config = $this->wire->config; $url = $config->urls($this); $config->scripts->add($url."lib/moment.min.js"); $config->scripts->add($url."tabulator/js/tabulator.min.js"); $config->scripts->add($url."Grid.js"); $config->scripts->add($url."RockGrid2.js"); $config->styles->add($url."tabulator/css/tabulator.min.css"); }); using the "before" hook makes it possible to use the config->scripts|styles->add syntax ? I'd love to get a $config->scripts->addAfter("/my/script.js", "/my/other/script.js") feature - but acutually I've always found a way to get the correct order by using proper hooks...1 point
-
Long time no module ? Github: https://github.com/baumrock/RockIframe Modules Directory: https://processwire.com/modules/rock-iframe/ Problem Sometimes the editor wants to see a preview of a file while editing a page. For example this can be helpful when digitizing invoices. Regular ProcessWire panels can be used for preview but overlap the page editor so the user has to open and close the panel repeatedly while working. RockIframe shows a preview of any content that can be rendered in an iframe and keeps the page editor 100% visible to the user. Usage Simply call $modules->get('RockIframe')->show('path/to/your/file.pdf') anywhere in the admin to show your data in a sidebar iframe on page load. You can also define a Pagefile(s) object as source of the iframe. Example This example shows the first file of the field myfilesfield on the page edit screen of pages having template mypagetemplate: $wire->addHookAfter("ProcessPageEdit::buildForm", function($event) { $page = $event->process->getPage(); if($page->template !== 'mypagetemplate') return; /** @var RockIframe $iframe */ $iframe = $this->wire->modules->get('RockIframe'); if($iframe) $iframe->show($page->get('myfilesfield')); }); Ideas & Notes PDF preview relies on the browser's capability to preview PDFs. Also at the moment there are no checks which content is thrown to the iframe as source. For images for example we could use https://leafletjs.com/examples/crs-simple/crs-simple.html to enable panning & zooming on the image. For better browsersupport of PDF we could use https://mozilla.github.io/pdf.js/web/viewer.html;1 point
-
Glad it helps! That's already possible - I've added an example to the readme: $wire->addHookAfter("ProcessPageEdit::buildForm", function($event) { $page = $event->process->getPage(); if($page->template !== 'mypagetemplate') return; /** @var RockIframe $iframe */ $iframe = $this->wire->modules->get('RockIframe'); if($iframe) $iframe->show("http://www.example.com"); });1 point
-
Hi, welcome to ProcessWire and the forums! You have to click on “Child page example 1” first, and only then move the other page. Clicking on the new parent “opens” it, which is only really noticable in the UI by the line underneath it the background becoming slightly darker (when using Admin Theme Uikit). I agree this is way too obscure, although having to open the parent before adding a child is somewhat logical. In other systems often the parent can be coerced into opening by hovering the dragged child over it a little. That seems like a worthwhile idea here, too.1 point
-
I have not thought about the technical view, but I liked how your example really felt more "PW-ish" (like hooks) than my first approach. But I didn't like that it worked different to normal autoload modules... I came up with this idea that at least for my taste merges best of both worlds: <?php namespace ProcessWire; class FooModule extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return [ 'title' => 'FooModule', 'version' => '0.0.1', 'summary' => 'Your module description', 'autoload' => true, 'singular' => true, 'icon' => 'smile-o', 'requires' => [], 'installs' => [], ]; } public function init() { $this->addRoute("/my/custom/{user}/endpoint/{action}", $this, "userEndpoint"); } public function userEndpoint($event) { // get parameters from route and sanitize them // not sure about the syntax? maybe $event->route->get('user', 'int'); $user = $event->api->get('user', 'int'); $action = $event->api->get('action', 'string'); $method = $event->api->method; if($method == 'GET') { // return found data as json $result = $this->wire->pages->findRaw([ 'template' => 'foo', 'user' => $user, ], ["title", "foo", "bar"]); return $this->api->json($result); } elseif($method == 'POST') { // update database // some kind of helper (https status codes etc) // would be nice, but I don't have much experience // with APIs so there might be others to talk to :) $user = $this->wire->users->get($user); $user->setAndSave('action', $action); return $this->api->success("Updated $user's action to $action"); } else { throw new Wire404Exception('Not allowed'); } } } or in init.php: $wire->addRoute("/my/custom/{user}/endpoint/{action}", function($event) { // get parameters from route and sanitize them // not sure about the syntax? maybe $event->route->get('user', 'int'); $user = $event->api->get('user', 'int'); $action = $event->api->get('action', 'string'); $method = $event->api->method; ... });1 point
-
v0.0.30: Working with select options fields got easier today ? $rm->migrate([ 'fields' => [ 'yourfield' => [ 'tags' => 'myTag', 'type' => 'options', 'inputfieldClass' => 'InputfieldRadios', 'optionColumns' => 1, // side by side 'options' => [ 1 => 'Eingangsrechnung', 2 => 'Ausgangsrechnung', ], 'required' => true, 'defaultValue' => 1, ], ], ]); Setting the "options" as array has not been possible until now.1 point