Leaderboard
Popular Content
Showing content with the highest reputation on 08/20/2022 in all areas
-
I hope you are having a great week. Today I've released new versions of two ProcessWire ProFields modules: Table and Combo. In addition to various minor improvements and fixes, the biggest update in both is the addition of file and image fields. Since this is a fairly major feature addition for both modules, please consider these versions in a beta test stage for the moment. Both are available for download in the ProFields board now. Table v23 In ProFields Table both "file" and "image" column types were added. These are fairly basic file upload fields, but a major improvement over not having them at all. It can hold one file per column per row in the table. You can have as many file columns as you need per row. The front-end value of your file or image columns is one you are likely used to using already: Pagefile or Pageimage objects, just like they would be in a regular single-file or image field. This means your file/image values in your Table rows can benefit from many of the built-in methods you already use, such as the ability to present resized images, WebP variations, etc. When you configure a file column you can specify what extensions you want to allow and the maximum number of bytes you are willing for it to accept in an upload. When configuring an image column, you also gain settings to specify the thumbnail image preview size in both regular and HiDPI resolution. Combo v9 The update for Combo fields was similar to the Table field except that file and image fields go quite a bit further in Combo than they could in Table. Specifically, you get almost the full set of InputfieldFile/InputfieldImage configuration settings and features, including the ability to support both single and multi-file uploads, image actions, variations, focus control, description input, tags input and more. The only things missing relative to a regular File/Image field are the manual Crop action (Image field) and the ability to manage separate custom fields for each file or image. The front-end value for your Combo file fields is identical to what it would be on a regular ProcessWire File or Image field. Specifically a Pagefiles or Pageimages (plural) object if supporting multiple files, or a Pagefile or Pageimage (singular) object if supporting 1 file. To say it another way, you can use this exactly as you use other dedicated file/image fields in ProcessWire. Not yet included is the ability to query the properties of a file/image field from selectors, like when using $pages->find(). I'm still working on that part, but since I know most probably don't need that I decided to get this version out first and then continue working on that part. Core updates The core updates this week were mostly minor, even if there were a lot of them. One of the ways that I stay up-to-speed on all the core code is to regularly read through all of it and make small adjustments along the way... anything that makes the code easier to read, or easier for PhpStorm to inspect it. You've seen these kinds of updates pretty much every week for years, but I hadn't thought to mention it before. This week there were more of these kinds of updates than usual so I just wanted to mention that what it's for. What sometimes looks like micro-optimization or minor code changes is usually just me staying fresh and up-to-date with the core. ? That's all for this week. I hope you have a great weekend!7 points
-
Works great as an alternative to repeaters. Way fewer pages. For example I use it on my ecommerce site to hold what items are in a person's cart.5 points
-
With the ease of Processwire in my hands I feel I can almost do anything to make the website of my dreams ? It's actually getting easier by the day to just not rushing into things and start to think about structure first. Now I am focused what I want to display, later on how to make it look. But there are still some things I do not find with ease on the PW docs. For example, possibilities for sort. By mistake I found out sort=-title (minus sign), is actually sorting on title from Z to A. Another thing is, the difference between Finding and Getting pages it beyond me. Could not found it, did not get it ?. Right now, I am developing a website as affiliate. This means I display product redirecting to certain sellers. But my children have a large part in it: they enhance the look, improve images, test things, and give feedback. My steps to a professional website so far: Getting to know Processwire, so much information to grab. I now know, at install, the code on the pages are examples, not mandatory! Structure files in the root of the website first. Then templates, and pages - according to my idea (what is logic and what is not handy in my situation. Find a template to use with ease: I have found a great free HTML bootstrap 5 template that I use right now. Try behavior design: what would you do on this website you are looking at right now? Take regular breaks, don't try to push things in a limit time, do not make it difficult. But the main thing is: Processwire is so much fun to develop websites (no joke) 10+ for PW. Enjoy3 points
-
Granted, I don’t have much experience with the complex column types (I only just updated after 10 years or so, to get the Page type), but if you primarily use primitive types, ProFields Table has the benefit of being a single SQL join away. So if you’re like me and you sometimes want to do custom queries, that’s pretty cool. Plus, while I have nothing against repeaters, for some things it just feels icky to have the Page overhead. I have a site with playlists, so there’s a table with Artist, Title and some auto-generated normalisation columns for search, for example. Another site manages ”trips“ using a column for the place and two DateTime columns for the duration. I think the need to connect multiple Page references to some metadata like dates is pretty common, and ProFields Table is perfect for that.2 points
-
Check this one out: Processwire on the web with wirekit - - - https://bestofphp.com/repo/kreativan-wirekit-core https://github.com/kreativan/wirekit-core https://start.wirekit.dev/core/wirekit/ui/2 points
-
I hope that you all are having a great week! This week I've been working on some updates to the User Activity module and have released version 5 in the ProDevTools board. This version focuses on adding several new requested features, including the following: New options to also detect when you (yourself) are editing the same page in 2+ windows and when you have modified a page in a different window. These are the “collide-self” and “modify-self” options in module config. The module now keeps track of what fields have changed in the page editor and stores them with the activity so that they can be shown in the activity viewer or in page edit alerts. When a page has been modified that is also open to another user it now presents them with a dialog giving the option to reload the page or keep editing. A new “lock” option has been added that blocks a user from editing a page when it is already being edited by another. This is an alternative to just warning them with a pop-up, and it literally prevents them from being able to open the page in the page editor. This can be enabled in the module config and can also be optionally disabled for superuser. A new configuration setting has been added that lets you configure the refresh time in the page list (previously it was not editable). Added feature to limit the “you've been idle for awhile…” to the page editor only. When enabled, idle is still tracked for other admin processes, but idle alerts don't appear. Improvements to ProcessUserActivity (the included activity viewer module), including: 1) visible vs. hidden states are now more obvious. 2) Changes made in page editor are now included in the activity information. 3) The ajax drop-down navigation summary has been improved to include more information. Large portions of the module have been refactored into separate classes for better maintainability and other related improvements. This week there have also been a few commits to the core, but mostly just small fixes and phpdoc improvements, so not enough to write about here, but there likely will be next week. Thanks for reading and have a great weekend!1 point
-
This is in the selector docs, right were you would expect it ? Granted, the page is pretty long and cluttered when you’re just scrolling through, but it’s great for CTRL+F’ing and the table of contents at the top is very helpful. Mostly “find“ means “I have some criteria, give me any pages that match it” (only those the user may view, by default). “Get” means “I know exactly which page I want, give it to me”. Get gives you one specific page, Find gives you multiple. There is also pages()->findOne() if you only want a single page – the difference here is that this will check if you have access first, while pages()->get() will always give it to you if it exists, even if it’s unpublished or hidden. Anyway, rock on! I’m sure you will be enjoying PW for years to come ?1 point
-
What you’re doing very much hinges on the stability of your products and the order they’re in between rendering the form and processing its submission. If you open the form in your browser and let it sit there for an hour while you or someone else adds, removes or modifies a product, you will update the wrong products when you get back to the form! This is because you’re using the products’ positions in the selector results to identify them. It would be better to use their IDs or their page names because those are much less likely to change. Consider this: <form method="post"> <?php $products = $pages->find("template=product, sort=title"); foreach ($products as $product) { ?> <li> <h3><?=$product->id?> <input type="number" value="<?=$product->amount ?: 0?>" name="product[<?=$product->id?>]" min="0" style="width: 50px;"> <?=$product->title?></h3> </li> <?php } ?> <button type="submit" name="submit" value="update" style="width: auto;">Bestand aktualisieren</button> </form> if ($input->post->submit) { $amounts = $input->post->product; $products = $pages->find("template=product, sort=title"); if ($amounts) { foreach ($amounts as $id => $amount) { $products->getPageByID((int)$id)?->setAndSave('amount', $amount); } } } Well, one answer is “because Ryan didn’t program it that way”. You were giving $pages->get() a Page that you already had. It certainly could work, because all the necessary information is there, but the get() method wasn’t programmed for that situation, because if you have the Page object already, why would you need to get it again? You can still do so by converting the Page object to a string (which is always its ID) or just getting its ID explicitly. Because your Page object was named $id, that would have been $pages->get($id->id). Here is an unrelated tip: you can just use single quotes instead of escaping the double quotes, because mercifully both are legal in HTML. You can even mix them in the same tag: <input type="text" value='call me ishmael'/>1 point
-
Yes, in a file with namespace ProcessWire that will let you use it: $foo = new \stdClass(); You can also put “use \stdClass” at the top if you need it a lot. The same goes for all the other stuff outside PW’s namespace. Often you’ll need \DateTime or \IntlDateFormatter for example. Edit: the technical term is “The Global Space”: https://www.php.net/manual/en/language.namespaces.global.php1 point
-
Put a backslash in front if you want to use PHP classes, or am I missing something? It’s near impossible to answer your question without knowing why you want to use stdClass. Could well be that ProcessWire has something suitable for your use case, but what is your use case?1 point
-
@wbmnfktr Consider the benefits of using a spreadsheet. The benefits of using a Table field are similar, and the data is all accessible, editable and searchable in PW. Table also has many of the benefits of repeaters, but without the overhead. It's much faster in terms of performance and much more efficient in terms of storage (1-1 mapping of input column to table column and input row to table row). On the admin/input side, it's more like using a spreadsheet than a typical Inputfield, which can sometimes be preferable for editors. Table is also much more scalable than other repeatable types (like repeaters). You can have just a few rows or tens of thousands of them, something that you couldn't do with repeaters. Table can also paginate its rows, both input side and front-end. Personally, I use Table on almost every site I develop. One obvious use case I also come across regularly is rate tables like here (click on pricing tab, this is developed with Table). While table is much more scalable than Repeater, it is not as flexible or powerful as Repeater. But when your needs crossover with what Table does, it is certainly preferable.1 point
-
if ($input->post->submit) { //it is a mystery to us what this, and since it comes //from the client, it may also be a mystery to you $amounts = $input->post->product; //you’re looking up pages, so this will be a PageArray //with arbitrary numerical indices $products = $pages->find("template=product, sort=title"); if ($amounts) { //apparently we’re assuming the client sent us an //array with meaningful indices foreach ($amounts as $index => $amount) { //because $products is a PageArray, you’re going to //get NULL or a Page object when you access it like //this. In your case probably NULL unless your client //can somehow divine what pages result from the above //selector AND in what order $id = $products[$index]; //because $id is either NULL or a Page, this selector //cannot work. It will work if you put $id in quotes: //– if $id is NULL it will look for nothing and give you // a NullPage. //– if $id is a Page, PHP will call toString() on it, // resulting in its ID, so you’ll just get the same // Page back. //Both paths seem useless though? $pages->get($id)->setAndSave('amount', $amount); } } } This is my understanding from looking at it… Can you explain what $input->post->product contains?1 point
-
First of all the better you describe your problem the better our answers can be ? That's not really a helpful description. But as you don't share more specific infos, this is what I'd do: Inspect the html code of your page and also the network tab and console of your browsers devtools Install TracyDebugger and add this to your ready.php: bd("ready"); You should see the "ready" dump in your tracy debug bar Add >> bd("module init"); << inside the init() method of your module and reload the page You should see the dump in the bar and that confirms that your module loads properly Then add >> bd("inside hook"); << at the top of your hook to make sure your hook code fires properly.1 point
-
What kind of things are you doing with ProFields Table... I used it once... just for catalogue data entries, that's all. Never really saw any real benefit using that module. Is there something I missed?1 point
-
Looks like I subscribed not a moment too soon ? ProFields Table is the greatest ???1 point
-
Also available in german ?https://www.ionos.de/digitalguide/hosting/cms/processwire/1 point
-
I just stumbled upon this pretty recent article by Ionos, one of the biggest hosting providers in Germany (formerly 1&1, not sure how big they are elsewhere): https://www.ionos.com/digitalguide/hosting/cms/processwire/ It’s in english and includes a comparison to Wordpress (the tabular comparison is kind of broken, though).1 point
-
Can you Test it with echo $input->post('modelId'); Or Just add an slash at the end: xhr.open("POST", "/ajax_handler/", true);1 point
-
Hi @Neue Rituale Seems like a useful plugin. Thanks for sharing your work with the community. If there is a video to show how it works would be very useful. Gideon1 point
-
I like repeaters for structuring data. For building a layout, not so much. I've seen the demo's on this forum of people using repeaters in creative ways to build a layout, but it never looks very intuitive to me. I've grown to dislike this approach so I've been looking at other content management systems for inspiration. Bolt CMS uses Article Editor, which is a nice (paid) javascript solution that's basically an advanced wysiwyg editor with support for grids and other nice features. I decided to integrate this into Processwire as an inputfield. Here's a demo: I created a few plugins for Article Editor that take care of uploaded images, inserting links and Hanna code support for adding dynamic bits to the editor. And the field also works in repeaters. You can pass your CSS to the editor so that the editor preview should look identical to the real page. I am using Bootstrap. A bonus of building a page this way is that the whole layout is stored in a single field so there should be fewer requests to the database compared to repeaters. Please note that since Article Editor is not free, you need a license to use it. I've been working on this module on and off for a while. There are refinements to be made, like perhaps loading the Hanna code previews dynamically (they are currently inserted into the editor after saving the page). Not sure if it would be good enough to release publicly but I thought I'd share it anyway because I'd like to hear if you think this is a nice approach :)1 point
-
For anyone who might be wondering. I'm about to talk with zynth about Larawire's future and I might start to work on it again. Maybe there are other community members that want to join the party …?1 point