Leaderboard
Popular Content
Showing content with the highest reputation on 03/20/2021 in all areas
-
I hope everyone is having a good week! Commits to the core this week include 10 issue report resolutions (so far). This will likely continue next week as well, and then I'll bump the version up then. Also included this week is an CKEditor upgrade from 4.14.0 to version 4.16.0. While that may sound like a minor CKEditor version bump, there's actually quite a list of updates in the CKEditor 4.x changelog, including a few security-related fixes, though none that I think are likely to affect PW users. I do still have a couple of core feature requests in progress as well, but there's more work still to do on those. Nothing too exciting this week, but I like to check in and say hello either way. I hope you all have a great weekend!6 points
-
Admin Restrict Branch Select is an add-on / companion module for Admin Restrict Branch. With this module enabled, you can manually select more than one branch parent per user via the branch_parent field, and users with more than one option selected will be able to switch between those while editing site content. Switching between branches is done via a select field injected at the top of the page tree. Note that users are still limited to one branch at a time: this module will not make it possible to view multiple branches at the same time. When the module is installed, it will automatically update the branch_parent field if deemed necessary, i.e. if it isn't yet configured to allow selecting multiple pages. You can make changes to the field later, if you want to restrict selectable options by template, use asmSelect instead of PageListSelectMultiple, etc. This is an early beta release, so be sure to test carefully before enabling this module in production! https://processwire.com/modules/admin-restrict-branch-select/ https://github.com/teppokoivula/AdminRestrictBranchSelect4 points
-
I'm really hoping the "everything needs to be node/react/js" fad/hype dies off soon. Twice today on 'important' sites (one an airline booking site), the ajax/promise/whatever failed. Was left looking a never-ending spinner. Awkward as had no idea where my flight booking went. Don't get me wrong, JS is useful but like most things in life, please use in moderation4 points
-
If you are not in a hurry, I think you should not jump the Node camp, as sooner than we might think all this JSON juggling hype will become history, read: https://alistapart.com/article/the-future-of-web-software-is-html-over-websockets/ It is time to ask @ryan for support for the WebSockets-driven approach ? We do not want to lag behind Rails, do we?4 points
-
Hey @adrian! Just a heads-up that I posted an updated and extended version of my code as a new add-on module: The functionality seemed pretty specific to one use case so I figured it was best not to bundle it in the main module, but feel free to use anything from my module if it makes sense to you. Turns out that the original implementation missed a few key points and was very specific to a particular site, so this is basically a full rewrite... ?3 points
-
Just did a quick test and it looks great - thanks for sharing this - I think it will be a great solution for many folks.2 points
-
As a novice user i had my problems understanding how multiple file/image upload works and how to delete only one selected uploaded image and not to delete all. It is very difficult for a novice user to understand the complicated examples and answers of the very experienced members. So i decided to make a very simple example for explaining the multiple file/image upload and selected delete. I am not an expert on Processwire, wanted only to share what i achieved so far. So there may be better ways to do the same. (Take this as an axample form a novice for other novices) WARNING : As this is only a very simple example; there are no validations and security checks in this example. So please dont use this on a real project without security checks etc. The attached fileexample.php is complete working example. (I made some last minute comment additions, hope i did not destroyed anything. If you have problems using the example file please inform me, i will check and correct) With this example you will be able to; - upload multiple images - delete only selected images you uploaded before. Especially for the second part (deleting only one image from a multiple image field) it is very hard to find examples and answers in the forum HOW TO USE THE EXAMPLE FİLE: 1- Create a TEMP directory for for fileupload below site/assets/ 2- Download the attached "fileexample.php file and edit line 24, write the path of the created fileupload temp directory. 3- Upload the "fileexample.php file to site/templates/ folder 4- Create an new field named "images" with type of images. 5- Add a new template. Choose "fileexample" from the recommended list. 6- Edit the "fileexample" template and add the created "images" field from step 4 to it. 7- Create a new Page and select "fileexample" as the template of this page. Now visit the newly created page and you will see 5 image input fields. It is possible to use only one inputfield, but it is more visual the way i choose in the example. The flow of the example is like this; When you visit the page the form is created. If there are already uploaded images the thumbnails are shown and a "Delete" button next to it. If there is no image than a image input is shown. As we used "$imageamount = '5';" if there are 2 images already uploaded you will see 2 thumbnail iamges with delete buttons netx to them and 3 image inputfields. If you choose some images on the image input fileds and hit the "Save" button than the code part starting with "if ($input->post->fileprocess){" is triggered. This part makes the file upload process. If you click the Delete button next to one thumbnail the script "deleteimage" is trigered. This script makes a ajax Post call the same page with the post variable "imagedelete". This ajax call sets "imagedelete" variable and so the code satrting with line "if ($input->post->imagedelete) {" Will be trigered. Here the most important part is the exit in the last line. As this is a Ajax call the call have to be terminated before anything is outputted. ----------------------------- Hope all is clear understandable. My English not so good, sorry. If you do not understand any part please ask and will do my best to explain it again. fileexample.php2 points
-
@JeevanisM have no answer to that question. It's one I'm asking myself. I truly hope I don't simply to win business, especially for clients who don't need it but are being lemmings and following the hype. I Googled the "benefits of REACT" and every SERP article was written by a JS developer who confused "benefits" with "features". Eg: "It manages state" is a feature, not a clearly defined benefit to the user2 points
-
I have updated Codepen with a solution. Be aware that is an hacky one, because on narrow screen some text clipping might occour. If you play with it a bit and you don't have a lot of text you can use it as a good starting point.2 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
-
It looks very cool, I'll follow its updates for version 2 release. +1 Here too ??1 point
-
1 point
-
I've just posted about a related topic/issue, the JavaScript/JSON bloat, which also "helped" not to speed up the internet, despite that lots of us are already connected via optical cables. But there is light at the end of the tunnel: HTML-over-WebSockets1 point
-
1 point
-
How are you doing your markup? You should have something like this: <input type="checkbox" name="color[]" value="red"> <input type="checkbox" name="color[]" value="blue"> Now color is an array: $selector = ""; $colorOptions = $sanitizer->array($input->get->color,'text'); if(count($colorOptions){ $colorOptions = implode('|',$colorOptions); $selector = ",color=$colorOptions"; }1 point
-
Thanks for this example @elabx. I made my own version with checkboxes (multiselect). Only then did I come across the following problem. When I check 2 checkboxes in the same group, For example: Color = Red and Color = Green then only the products with the field green are displayed. After submit this what my url looks like: domain.com/?color=red&color=green I think it's too hard for me on a Friday ?1 point
-
@Erik for the sake of simplicity lets assume you have only a field for price. Your filter would be in a category/listing template, that lists your products(like in my example) /* The general outline would be: 1. Check if a filter was set by checking GET-parameter in URL 2. Read the parameter and build your selector for the $pages->find(""); 3. Execute the $pages->find with your selector 4. In case no filter was set execute your standard pages->find 5. List the result */ // 1. and 2. Check for GET-parameter in your URL if($input->get->price != ''){ $price = $sanitizer->int($input->get->price);// in my case price is integer not float $selector .= ', price<='.$price; $value_price = $price;// save the value for use in the filter input } // ...more parameter/filter to check here // ... // Very simplified... if($input->get){ // 3. execute the find on your products $allpages = $pages->find("parent=$page, $selector"); $log->save('filter', $selector);// write the build selector to a log, so you can check it }else{ // 4. on input->get so list all unfiltered pages $allpages = $pages->find("parent=$page"); } // 5. List your products foreach($allpages as $one){ // your list of products, filtered or not... } This would be the first step. The second step would be to build the form with the filter input field: // in my case I use delayed output, but you may not... $filterform .= '<form id="filter" action="'.$page->url.'" method="get">'; $filterform .= "<label for='price'>Max Price</label>"; $filterform .= "<input type='number' name='price' id='price' placeholder='input max price...' value='$value_price'>"; // ... $content .= $filterform; The rest is pretty much fine tuning...1 point
-
This site-profile for ProcessWire offers a simple and responsive blog which doesn't require any module. It works exclusively with some template files. See: https://processwire.com/modules/site-simple-blog/ Installation This site profile is intended for use with a new installation of ProcessWire. Download ProcessWire, extract all files and folders and upload it into your web server folder. Download the site profile, extract the site-simple-blog folder and upload it into the same folder. Start the installation. When prompted for Site Installation Profile select Simple Blog Profile for ProcessWire 3x and continue with installation.1 point
-
I always sticked to the golden rule: keep code separated from layout and it always served me very well. Funny how fashions like tailwind and the ever next bootstrap invite people to break with the golden rule and mix code again with layout Ajaxify is already replacing parts of a page without reloading the whole page for a long time and does it very easy1 point
-
Probably worth mentioning that since this setting prevents ProcessWire from using unfamiliar hosts in output, it's actually pretty important: Let's say that your server was configured to serve your site with any host that a visitor happens to provide. (I've seen this happen, but admittedly it's a major configuration fumble.) Someone points some-weird-and-perhaps-malicious-domain.tld to your site, and then visits the site using said domain. This could be intentional, or even an accident (again this is something I've seen happen, as weird as it may sound.) Finally some code — your own, or perhaps code from a third party module, or even some core feature — asks ProcessWire for the full hostname, and makes use of it in output. Now, if the $config->httpHosts setting didn't exist, ProcessWire would have no way to know which domains are valid, and it would just have to trust that the domain specified by the user is indeed a valid one. Any output using this potentially malicious domain could then get cached, leading to various cache poisoning related issues: redirecting other visitors to this domain, or perhaps making the visitor or ProcessWire itself unknowingly send private data there, thus granting a third party access to it.1 point
-
Thanks for all your suggestions. Here is what I use right now in my ready.php $wire->addHookAfter('AdminTheme::getExtraMarkup', function (HookEvent $event) { $parts = $event->return; $parts['head'] .= '<link rel="stylesheet" href="' . $this->config->urls->templates . 'admin/admin.css">'; $parts['head'] .= '<script src="' . $this->config->urls->templates . 'admin/admin.js"></script>'; $event->return = $parts; }); I don't want to rely on another module like AoS or AdminCustomFiles, because I think adding another module just to add styles and JavaScript is overkill and bloat. Instead I want to add the assets in my own modules, or in ready.php. I still think that it would be good in the core, and the core could still be lean. There are already methods there to prepend or append assets, but they don't work correctly because of the init order. Mainly the problem is that core modules should be loaded first with their assets like jQuery and CSS, etc, and then I should be able to add my assets after them to override them. I know it might be a specific case, where you want to alter default behavior and styles of the admin, but it is something I often need. In most cases the actual behaviour $config->styles->add($config->urls->templates . "admin/admin.css"); is just fine, if you are not trying to override some styles1 point
-
Of course ... /** * modify headline in page edit interface */ $wire->addHookAfter('ProcessPageEdit::headline', function($e) { // get id of page beeing edited $pid = (int) $this->input->get('id'); if (!$pid) return; $pageBeeingEdited = $this->wire('pages')->get($pid); if (!$pageBeeingEdited->id) return; $headline = "My ID is $pageBeeingEdited->id"; $this->wire('processHeadline', $headline); // no need to modify the return value ($e->return) });1 point