Leaderboard
Popular Content
Showing content with the highest reputation on 12/19/2020 in all areas
-
Thanks for this great new module @ryan! The Combo module seems in some ways like an enhanced ProFields Textareas: both modules provide multiple inputfields that look just like real separate fields in Page Edit but are contained in a fieldset and are actually just one field behind the scenes. As you've said, this is great for efficiency because it reduces the total number of fields needed for a project. In some big sites I've worked on the ProFields Textareas module has been fantastic because it's reduced the number of fields I need by 50% or more. The new Combo field looks like it will be even better than Textareas so I'm excited to start using it. But there is something that holds Textareas and Combo back from being even more useful, and that is the fact that all the subfields have to be rendered together inside a fieldset. In my experience there are many situations when you have fields in template that technically could be catered to by Textareas (and now Combo) but the problem is the layout in Page Edit: 1. The subfields of the Textareas/Combo are not sufficiently related to each other that they should be grouped together inside a labelled fieldset. What I mean is that as a developer you identify fields whose technical requirements make them a good fit for Textareas/Combo, but the fields don't conceptually belong in the same group in the mind of the client/administrator, so you don't want them all grouped together under one parent fieldset label. 2. You have some other separate fields (e.g. Repeater, ProFields Table) that you want to intersperse between the Textareas/Combo subfields. The consequence of these two problems is that it either isn't practical to use Textareas/Combo in some situations where it has the potential to avoid a lot of extra fields, or you end up creating many more separate Textarea/Combo fields than are necessary or desirable from a technical point of view. You might remember that I raised this in the Textareas forum, and ended up making a hacky module that rearranged the Textareas subfield inputfields in Page Edit so I could get around the two issues described above. But what I'm dreaming of is having a core or official ProFields solution to this... What I'm imagining is an enhanced version of the core template editor. If a field is added to a template and the fieldtype reports that it renders multiple subfield inputfields (Textareas and Combo are the only fieldtypes I can think of that do this, but perhaps more fieldtypes will fit the bill in the future) then those subfields become individually sortable in the template editor. So it would be possible to make a layout in Page Edit that went something like... title combo.text repeater combo.textarea table combo.integer etc Here's a screenshot of the interface of my hacky module to show the general idea - although this is actually separate from the template editor and is therefore not nearly as good as it could be. (And before anyone asks, this module is way too buggy and hacky for me to release publicly, hence my request for a solution from Ryan). I know this wouldn't be a simple thing to implement but I think it would make ProFields Combo and ProFields Textareas hugely more useful. Thanks for considering!10 points
-
I’ve just released the first version of the ProFields Combo field and it’s now available for download in the ProFields support board download thread! Rather than writing a long post today, I’ve instead focused on writing the Combo field documentation. The documentation page includes a lot that you may already know from previous posts, but it also includes a lot of new details that haven’t yet been posted. Please consider this version to be a development/beta version. It’s the first release and hasn’t had a lot of testing yet, so consider it not yet ready for full production use. Though if you get a chance to test it out, please let me know how it works for you. I appreciate any feedback you have. A couple things I haven’t yet tested thoroughly enough yet are exporting/importing of Combo fields or pages using combo fields. I also haven’t done enough testing in FormBuilder yet. So I’d recommend avoiding use of PW’s field or page export/import functions with this, or using in FormBuilder, at least for a few days. By next week I will have tested those things and made any necessary updates. Thanks for reading and have a great weekend!8 points
-
I have used session variables in combination with ProCache a few times and it always worked. But that is just my experience.2 points
-
@netcarver @androbey Just pushed out 1.0.2 on Github. was a very simple fix actually but took a while for me to figure it out doh might take a while to show the new version on the modules site but will try and update that now too2 points
-
Well, hello somebody! Look at what I've stumbled upon ?. Tailwind Starter Kit A beautiful extension for TailwindCSS. Tailwind Starter Kit is Free and Open Source. It does not change or add any CSS to the already one from TailwindCSS. It features multiple HTML elements and it comes with dynamic components for ReactJS, Vue and Angular. Yes and vanilla JS as well! (currently, 16 dynamic components.). License: MIT GitHub: https://github.com/creativetimofficial/tailwind-starter-kit Site + Demos: https://www.creative-tim.com/learning-lab/tailwind-starter-kit/ A tutorial on YouTube. I haven't dug in deep yet (e.g. purge/tree shaking, etc). @Jonathan Lahijani. What do you think? ?2 points
-
An inputfield module that brings EasyMDE Markdown editor to ProcessWire. EasyMDE is a fork of SimpleMDE, for which there is an existing PW module. Inputfield EasyMDE has a few advantages though: EasyMDE seems to be more actively developed than SimpleMDE, which hasn't seen any updates for several years. You can define options for Inputfield EasyMDE. Inputfield EasyMDE can be used in Repeater fields and in custom fields for File/Image fields. Inputfield EasyMDE EasyMDE (Easy Markdown Editor) as an inputfield for ProcessWire. EasyMDE is a Markdown editor with some nice features, allowing users who may be less experienced with Markdown to use familiar toolbar buttons and shortcuts. More information is at the EasyMDE website. Installation Install the Inputfield EasyMDE module. Usage Create a new textarea field, and in the "Inputfield Type" dropdown choose "EasyMDE". Save the field and if you like you can then configure the EasyMDE options for the field as described below. To convert Markdown to HTML you can install the core TextformatterMarkdownExtra module and apply the textformatter to the field. Alternatively you can use $sanitizer->entitiesMarkdown() on the field value, e.g. echo $sanitizer->entitiesMarkdown($page->your_field_name, ['fullMarkdown' => true]); Configuration On the "Input" tab of the field settings you can define EasyMDE options for the field in JSON format. Refer to the EasyMDE documentation for the available options. Keys in the JSON must be surrounded with double quotes. Example: "toolbar": ["bold", "italic", "heading", "|", "side-by-side"], "sideBySideFullscreen": false https://github.com/Toutouwai/InputfieldEasyMDE https://processwire.com/modules/inputfield-easy-mde/1 point
-
Hi everyone! I just wanted to give a quick sign of life. The time of Christmas vacation is finally reached and I can finally invest time in open source project again. Thanks a lot for your input. In the next days there will finally be an update for the AppApi module. I would then like to provide you with a development state for testing before a new master version is released. Let us list the feature-requests: Error when importing database dump: Cannot add foreign key constraint (by @thomasaull) Multi Language and ProCache do not work Weird HTTP status responses (by @David Lumm, thanks for PR ?) [Feature] Add multiple levels to routing config (by @David Lumm, thanks for PR ?) Optional extended logging like @benbyf said earlier. Created Issue #10 on Github so I don't forget it. I will look into the other bugs and issues discussed here as well. Did I leave something out? Thank you for your help and stay tuned for the next updates!1 point
-
or simply ... $s = $modules->get('SessionHandlerDB')->getSessions(); // seconds = 300, limit = 100 $online_user_ids = array_filter(array_column($s,'user_id'), function($id) {return $id != 40;}); // with all arguments $seconds = 86400; // one day $limit = 200; $s = $modules->get('SessionHandlerDB')->getSessions($seconds, $limit); $online_user_ids = array_filter(array_column($s,'user_id'), function($id) {return $id != 40;}); Unfortunately this doesn't work if ProcessWire is bootstrapped https://github.com/processwire/processwire-issues/issues/1294#issuecomment-748057420 I have to correct myself. It works also if ProcessWire instance is bootstrapped $otherPwInstance = new ProcessWire($config->paths->root . 'site/'); $s = $otherPwInstance->modules->getModule('SessionHandlerDB', array('noPermissionCheck' => true))->getSessions(); $online_user_ids = array_filter(array_column($s,'user_id'), function($id) {return $id != 40;});1 point
-
Thanks, this looks good at first glance. I'm going to give it a spin as soon as I find the time. I'll probably want to let the user choose between client and server side tradeoffs depending on the use case, which also means deciding which is the reasonable default.1 point
-
1 point
-
@BitPoet I've cloned the module and pushed an experimental script for deleteFor() here. It uses a Lua script that's evaluated in the Redis server. My rough testing using 100k namespaced keys shows this to be much faster than iterating over the scan results in PHP and the PHP cpu + network load is also much lower. However, that is at the cost of blocking the Redis server whilst the delete is taking place. I've not massaged this into a pull request yet, as I'd like to get your feedback on it.1 point
-
If you are handling real Adult content this is not enough - at least in the EU region. You can use a lot of cookies and checks to serve rendered HTML (depending on your region with a small whitelist/blacklist of words or based on corporate decisions without any of those) without any images or videos and you are fine. See recent changes over at P*rnh*b. They had to delete a lot of content due to reasons. Maybe define your or your business's goals to make the need more clear. There are a lot of ways to skip certain things. As said before... if you have to deal with REAL ADULT content... there forums out there that describe ways to get around restrictons. Most basic solution is - as far as I know - log in those who confirm with YES, OVER 18 WHATEVER... and deliver content which is viewable for those. You might want to use Login Register Pro for that. Which works fine as I have heard from others. *cough*1 point
-
@androbey Just tested it on a fresh install. it is indeed broken ? I assume some update has changed how the admin stuff works? I will try and fix it over the weekend for you guys1 point
-
Although LazyCron and web-based task execution are supported, tasks should be invoked by command line tools (e.g. Unix cron), not from the the Web server environment. See the wiki. Tasker uses process control functions for checking signals (e.g. an execution timer) which should be safe to use in a webserver environment but the code also monitors the SIGINT and SIGTERM interrupts that should be moved to the command line specific part. And it seems I need to check the availability of that function. Thanks for pointing this out.1 point
-
Cloudflare announced the general availability of their new Web Analytics solution today (even for non-Cloudflare-powered sites): https://blog.cloudflare.com/privacy-first-web-analytics/ I'm quite excited about this, as I've been looking for a solution that's both privacy-friendly, free for personal sites and GDPR compliance. In particular, being able to collect visitor statistics without tracking any personal data is an attractive proposition, since it doesn't require consent even under the GDRP. I looked at various alternatives, but all have their caveats: Google Analytics is out for obvious reasons. Matomo is a solid choice since it can be configured to not set any cookies and anonymize IP addresses. However, it's use of fingerprinting is somewhat dubious, so it's a grey area whether you need consent to use it. A couple smaller alternatives like Netlify Analytics (for Netlify sites) or fathom look good enough, but their pricing isn't really feasible for small personal projects. I have added the Cloudflare tracking script to my tutorial site processwire.dev, for now I'll use it alongside Matomo. Will be interesting to see how their numbers compare to Matomo. What do you all think? Are there better alternatives out there?1 point
-
I use the classLoader in my TrelloWire module, you can look at the source code here. As you can see, this adds the src directory inside the module files to the WireClassLoader as the location to look for classes inside the namespace ProcessWire\TrelloWire. Almost; it doesn't preload the classes, but only on demand. This way, once I instantiate the class ProcessWire\TrelloWire\TrelloWireApi, the WireClassLoader looks for the PHP file for this class inside the src directory (the one registered for that namespace through addNamespace). If it couldn't find it, an error would be thrown. (If you're wondering why I don't use the fully qualified namespace, note the use statement at the top). Two main advantages: Using an autoloader, you can map classes to directories. The exact mapping (how namespaces are resolved to file paths) is defined in the PSR-4 standard. As far as I know, the WireClassLoader loosely complies with that. Composer mostly does the same thing (although a bit more elaborate, with optimizations for production usage etc.). Basically, you have a root directory mapped to a root namespace (in this case ProcessWire\TrelloWire -> src/ directory), and from there resolve sub-namespaces to sub-directories and the class name to a file name (so ProcessWire\TrelloWire\TrelloWireApi -> src/TrelloWireApi.php). The advantage is that you add namespaces wholesale. So you only need to add the mapping for the root namespace, and can then add as many classes and nested namespaces and classes without having to worry about including any class files manually because they will be autoloaded. Because class files are only included on-demand, only the classes you actually need for a request will be loaded. This of course cuts down on processing time, since otherwise you'd usually include all classes at the top for every request. Hope this clears up some of the confusion!1 point
-
Here a short tutorial of how to use file fields in ProcessModules because I needed that today. File fields are somewhat special as they are usually connected to an existing page with an existing ID and folder in /site/assets/files. But it is also possible to use the Inputfield alone to provide a GUI for uploading files (just like it is done in ProcessDatabaseBackups or the Modules GUI): /** * Import CSV file * * @return string */ public function executeImportcsv() { $form = $this->modules->get('InputfieldForm'); /** @var InputfieldForm $form */ $tmpDir = $this->files->tempDir('upload_csv'); // get path of temp directory $f = $this->modules->get('InputfieldFile'); $f->extensions = 'csv'; $f->maxFiles = 1; $f->descriptionRows = 0; $f->attr('id+name', 'upload_csv'); $f->label = 'Upload CSV'; $f->icon = 'download'; $f->destinationPath = $tmpDir; // here we set a custom destination path $form->add($f); $form->add([ 'type' => 'submit', 'name' => 'submit', 'icon' => 'download', 'value' => 'Import', ]); if($this->input->post->submit) { $form->processInput($this->input->post); // if there where any errors we exit early and render the form // we also exit here if no files where uploaded if($form->getErrors() OR !count($f->value)) return $form->render(); // loop all uploaded files // here we have only one file maximum, but still it is an array foreach($f->value as $pagefile) { // the regular pagefile's filename is incorrect because it links to // /site/assets/files and not the tempDir, so we get the correct path $file = $tmpDir . $pagefile->basename; // ####################################### // now do whatever you want with that file // ####################################### } // redirect to somewhere $this->session->redirect("/admin/somewhere/"); } // form was not submitted, so render it return $form->render(); } The result: When you upload an invalid file it will show a warning:1 point
-
Quick 'n' dirty guide if you want a single page tree with the same content in different languages. The URLs will then look like example.com/en/my-article or example.com/de/mein-artikel 1:) Download and install ProcessWire 2:) Install the modules you find under the "Language" Tab. 3:) Go To Setup->Languages and add new languages. Please note, that the default one is also the default language of your site* 4:) For every field type text or textArea change the Type to TextAreaLanguage or TextLanguage. (e.G. body with TextArea becomes body with textAreaLanguage). You fields should now have multiple tabs for each language, if you edit a page. 5:) Go to the root page (/) and look under "Settings" Setup an URL for every language, e.g. en,de,ru,... . Looks like this: http://take.ms/34Tq5 6:) Create pages and fill in the content. You can build a front end language switch as described in Ryans API Language page. ProcessWire will take care of changing URLS (e.g. /en/example to /de/beispiel) and you can access the current language via $user->language; *It's possible later to define another language as the default language.1 point