Leaderboard
Popular Content
Showing content with the highest reputation on 09/26/2018 in all areas
-
Latest version adds a new Inputfield Settings section to the RequestInfo panel when viewing a field in the admin. This is not turned on by default, so visit the module settings if you want to take it for a spin. Speaking of the module settings, all relevant panels now have direct links to their section in the module config settings, eg: The cog/gear icon at the bottom right will take you directly to this, which will hopefully make changes to panel settings much easier/quicker. Thanks to @bernhard for this suggestion.5 points
-
@netcarver Thanks for lookin' into this. I will take a little time this week to update the module. Thanks steve.2 points
-
and here is the final code for the php template for the hidden page that will get all the available coupons ONLY via ajax: <?php namespace ProcessWire; $couponsArray = array(); $couponsJSON = ''; $coupons = $pages->find("template=paddiscount, title!='', pad_percentage!=''"); if($coupons->count) { foreach($coupons as $coupon) { $couponValidUntil = $coupon->pad_valid_until ? date("Y-m-d", $coupon->pad_valid_until) : ''; $couponsArray[$coupon->title] = $couponValidUntil; } header('Content-Type: application/json'); $couponsJSON = json_encode($couponsArray); } if($config->ajax) { echo $couponsJSON; } ?> If I did something wrong please let me know.2 points
-
@Robin S you made my day ?! That works like a charm!!!?? I tried to combine that somehow, but didn't find the right way... (and also didn't find the right selectors ? as mentioned in your posted link). I thought, that this could be combined, but so I tried to go the other way as posted in my question. Perfect - many thanks for your help - learned again something new ??2 points
-
FieldtypeMatrix and InputfieldMatrix Modules Directory: http://modules.processwire.com/modules/fieldtype-matrix/ GitHub: https://github.com/kongondo/FieldtypeMatrix The module Matrix enables you to save data from a 2D-Matrix table. The rows and columns of the matrix table are made up of pages retrieved via a ProcessWire selector or via a page field selection of parent pages. The matrix values are made up of the data input in the matrix cells, i.e. the 'intersection of rows and columns'. Example Usage You have Products whose prices vary depending on colour, size, material, etc. Using the Fieldtype, you can create a table with rows made up of colours and columns made up of sizes the combination of each making up their respective values (in this case price). So rather than creating multiple text fields to do the following: Colour Size Price Red Small £10 Red Medium £20 Red Large £30 Red X-large £35 Green Small £9 Green Medium £15 Etc... You can instead have the following in one field: Small Medium Large X-Large Red £10 £20 £30 £35 Green £9 £15 Blue Etc... Yellow Purple If you set a selector in the Field's settings, to retrieve pages to build your matrix's rows and columns, it follows that all pages using the template the Fieldtype is attached to will have identical rows and columns. In some cases, this could be the intention. For instance, you might have 'Car' pages, e.g. Audi, Volvo, Ford, Citroen, Mazda, BWM, etc., each of which uses a 'Cars' template that has a single FiedltypeMatrix called 'car_attributes'. If you set a selector to build the Fieldtype's rows and columns, your users can easily compare the cars based on a combination of different values. The following matrix table best illustrates this: Type Engine Size Fuel Efficiency Carbon Emissions Warranty Road Tax Price 1994 Audi brand 1 values, etc. 2000 Audi brand 2 2006 Audi brand 3 2012 Audi brand 4 Each of your car pages would have similar matrices. This allows you to make easy but powerful queries. Such a setup allows you to compare within and across car brands. Say you wanted to find out which car(s) offered the best value for money given certain parameters such as warranty, emissions etc. You can easily make such comparisons (see code below). You can also compare within one car type, e.g. which brand of BMWs does best in what area...The possibilities are endless. In the database, Rows and column pages data are stored as their respective page->id. Matrix-values store any data (varchar(255)). If instead you wanted a template's pages to each have a matrix built of different rows and columns, you would have to name a Multiple Page Field (attached to the same template as the as your matrix field) in the matrix field's settings. When editing those pages, your matrix table's rows and columns will be built using the published children pages of the 2 pages you select in the Multiple page field.. The module allows the creation of matrix tables of any sizes (rows x columns). The rows and columns dynamically grow/shrink depending on the addition of row/column pages that match what you set in the matrix field's settings (see its 'Details Tab'). Please note that, if such pages are deleted/trashed/hidden/unpublished, their data (and presence) in the matrix are also deleted. Entering values in the matrix You have three choices: Manually entry Uploading a comma delimited (CSV) file. This can be delimited by other characters (tab, pipe, etc); not just commas Copy-pasting CSV values. (Tip: you can copy paste directly from an Excel spreadsheet. Such values will be 'tab-delimited'). In addition, if your server supports it, in the field's settings, you can enable the use of MySQL's fast LOAD DATA INFILE to read and save your submitted CSV values. Note that for large tables, you may have to increase your PHP's max_input_vars from the default 1000 otherwise PHP will timeout/return an error and your values will not be saved. I have successfully tested the module with up to ~3000+ values (10x350 table), the Fieldtype is not really optimised (nor was it intended) to handle mega large matrix tables. For such, you might want to consider other strategies. Install Install as any other module. API + Output A typical output case for this module would work like this: The matrix's rows, columns and values are subfields of your matrix's field. So, if you created a field called 'products' of the type FieldtypeMatrix, you can access as: product.row, product.column and product.value respectively foreach($page->matrix as $m) { echo " <p> Colour: $m->row<br /> Size: $m->column<br /> Price: $m->value </p> "; } Of if you want to output a matrix table in the frontend: //create array to build matrix $products = array(); foreach($page->matrix as $m) $products[$m->row][$m->column] = $m->value; $tbody ='';//matrix rows $thcols = '';//matrix table column headers $i = 0;//set counter not to output extraneous column label headers $c = true;//set odd/even rows class foreach ($products as $row => $cols) { //matrix table row headers (first column) $rowHeader = $pages->get($row)->title; $tbody .= "<tr" . (($c = !$c) ? " class='even' " : '') . "><td class='MatrixRowHeader'>" . $rowHeader . "</td>"; $count = count($cols);//help to stop output of extra/duplicate column headers foreach ($cols as $col => $value) { //matrix table column headers $columnHeader = $pages->get($col)->title; //avoid outputting extra duplicate columns if ($i < $count) $thcols .= "<th class='MatrixColumnHeader'>" . $columnHeader . "</th>"; //output matrix values $currency = $value > 0 ? '£' : ''; $tbody .= "<td>" . $currency . $value . "</td>"; $i++; } $tbody .= "</tr>"; } //final matrix table for output $tableOut = "<table class='Matrix'> <thead> <tr class=''> <th></th> $thcols </tr> </thead> <tbody> $tbody </tbody> </table>"; echo $tableOut; The module provides a default rendering capability as well, so that you can also do this (below) and get a similar result as the first example above (without the captions). echo $page->matrix; Or this foreach($page->matrix as $m) { echo $m; } Finding matrix items The fieldtype includes indexed row, column and value fields. This enables you to find matrix items by either row types (e.g. colours) or columns (e.g. sizes) or their values (e.g. price) or a combination of some/all of these. For instance: //find all pages that have a matrix value of less than 1000 $results = $pages->find("products.value<1000"); //find some results in the matrix (called products) of this page $results = $page->products->find("column=$country, value=Singapore");//or $page->products->find("column=$age, value>=25"); //$country and $age would be IDs of two of your column pages Other more complex queries are possible, e.g. find all products that are either red or purple in colour, come in x-large size and are priced less than $50. Credits @Ryan on whose Fieldtype/InptufieldEvents this is largely based @charger and @sakkoulas for their matrix ideas Screens Field Details Tab Inputfield Larger matrix table Example output1 point
-
Looks OK. It's good to exit/halt() after echoing the JSON. Either of these (although halt() may be preferable in some cases). if($config->ajax) { echo $couponsJSON; return $this->halt(); // OR // exit; }1 point
-
Howdy @quickjeff, I'm using two fields, one for the visitor's ip and another for the timestamp. The visitor's ip allows for unique visits, and also for telling you who is visiting your site often. On another note, google analytics gives you this same information, and much more.1 point
-
well...solved! my .htaccess file on dev at the very end of the page (after the processwire directives) ################################################################################################# # END PROCESSWIRE HTACCESS DIRECTIVES ################################################################################################# had this little code that caused the issue: RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC] I deleted it and now I'm feeling better... ?1 point
-
1 point
-
Sure. I have just made the change and spent some time refactoring the generation of the panel footer area to make future changes much easier.1 point
-
Thx @AndZyk for the Intelephense hint! Really awesome tool I was looking for for quite a long time ? Ever needed the correct collapsed state for one of your inputfields? No need to head over to the api docs any more ? and even with smart search (note that I typed "colloc")1 point
-
Really great addition! Thank you! I wonder what others think of having the icon left instead of right. I think it'd be an improvement. Maybe if others think the same it would be worth the effort. If not, I'm also happy to have it on the right side now ? Thx again!1 point
-
That's not true, please could you prove your statements with screenshots or the like and not just tell "it's not working"? And the current DEV: Recursive: You're welcome ? Yep, no reason not to use it IMHO.1 point
-
Hey guys, thanks for your ideas, but actually none of them would handle my problem. I updated the first post, to clarify things a little bit more. @bernhard Functional fields serve a whole different purpose. HandsOnTable seems not to support a Page Reference field and even if so, it would not prevent a user from entering a property multiple times. @BitPoet Matrix fieldtype is nice but also has the problem of preventing a user from entering a property multiple times. @elabx The properties are defined this way. Seems it was a little bit hard to read, that I already use a page reference field, so I updated my first post. I have some other fields, that work similar to what you described. I display them as checkboxes. but the last checkbox requires the input of an additional information (Umgebungsgeräusche) in a textfield. So I could add an additional textfield for every checkbox, and show them conditionally if a checkbox is selected, but that would make it hundreds of them, and this is why I used ProFields: table for it. I really think the best way is to go with ProFields: Table and disable used options in the Page Reference field (Eigenschaft). I will post my solution here as soon as it's ready.1 point
-
It's been there for about a week - pretty much just after all the new fullscreen and pane sizing shortcuts were added.1 point
-
@Bacelo, you can do all of that more efficiently in a single selector string: $termine = $page->children("(standort_reference~=$standort), (standort_alle=1), sort=date, limit=10, date>=today"); https://processwire.com/api/selectors/#or-groups1 point
-
Did you read my mind or was that always there? I wanted to post this request yesterday but found all shortcuts in the docs... then I thought why bother adrian again with something that is already there ? awesome! thx1 point
-
@joshuag Are there any updates on this awesome module already? Can't wait to try it.1 point
-
I actually stumbled upon these two articles when I did some resarch on saturday and I think I'm getting your point. However I don't agree with all of the statements made there: On the flow chart on the far right it says “I'll just use refresh tokens" which he states couldn't be revoked – afaik usually you save the refresh token in the datebase of your Auth Server and everytime a user wants to refresh a token you check if it is still valid. So e.g. you could hand out short lived tokens (like 5-10 minutes) and everytime it expires the client has to obtain a new token via the refresh token if it's not revoked. In an upcoming project we might have multiple endpoints for different task, where it just sounded good to have an Auth Server which holds all the user information and hands out tokens, which the client uses on the other server to access something. On "Footnote: microservice architectures" of part 2 the autor suggests to use single use tokens to get a session on the other service, which I think means, If I want to revoke a session I need to do it on multiple places right? Aaaanyway, I did some tests with the API Module, sessions and a cross-origin client and it also works quite well, so with 0.0.3 you can choose your auth method in module settings between none / session / jwt1 point
-
You should be able to do this for superusers only, if you need to :-); Read from here onward.1 point
-
I use this app on my Mac: https://www.bluem.net/en/projects/plain-clip/ Press SHIFT when launching Plain Clip.app to see its preferences settings panel. I use it by launching it with ctrl+option+command+V and afterwards my launcher app performs a paste operation by simulating command+V. This way I rarely run into copy/paste issues like that.1 point
-
New version adds some configurable settings for the ACE code editor used in the Console panel and the File Editor panel: I went with the defaults I like, but adjust to suit your preferences - don't judge my use of spaces over tabs - it's mostly about consistency when pasting into web forums and other places, but if you need another reason: Developers Who Use Spaces Make More Money Than Those Who Use Tabs ? I am also a big fan of 4 character indentation but I do know that some people prefer 2, so take your pick. The one thing that is new is the intro of Show Invisibles being set to true. That results in the following which I find quite useful at times. Note the highlighted (in pink) character at the end. That actually isn't due to the Show Invisibles setting, but I thought I'd include in this screenshot to bring attention to this thread: https://processwire.com/talk/topic/19995-changing-structure-of-pages/?do=findComment&comment=173671 and how the Console panel can be a useful tool in finding non-printable characters that are causing syntax errors in your code.1 point
-
Hi @Martijn Geerts, ran into an issue with ACF issuing notices on L123 of AdminCustomFiles.module due to unguarded access of the "theme" and "process" indexes on the index array. Changed code to: if (isset($this->index['theme'])) { foreach ($this->index['theme'] as $prop) $config->get($prop['type'])->add($prop['url']); } if (isset($this->index['process'])) { foreach ($this->index['process'] as $prop) $config->get($prop['type'])->add($prop['url']); } to fix this.1 point
-
Thank you @teppo A configurable endpoint ist not really difficult, so I just did it – 0.0.2 has a field in the module settings for that ?1 point
-
Hi @adrian thanks for the latest update to add autoload support (and to Ryan for putting it into the core this week) as I can now use Tracy in the preview tab in FormBuilder to do a little StreetAddress work. Much appreciated!1 point
-
Another round of tweaks, bug fixes and new features. 1) File Editor revamp to improve layout and adds a new fullscreen editing mode (like the one added to the Console panel), also with the same CTRL + SHFT + Enter shortcut for toggling in and out of that fullscreen. 2) More tweaks and code cleanup for the Console panel. 3) Some nice enhancements and cleanup for the SnippetRunner panel. 4) New "Open" option for the "Goto Page ID" feature in the PW Info panel - this opens the page's branch in the page tree. I find this entire feature very useful when working on sites where the templates make heavy use of IDs instead of paths for querying pages. If you haven't tried, give it a go. ? 5) Various bug fixes in the module and also in the Tracy core. There are quite a lot of changes in this version, so please let me know if you find any issues.1 point
-
Thank you all for your answers! Also interesting with URL segments and GraphQL. It seems it produces slightly slower requests, so I will test it for another project. Using a router solution like the one you pointed seems a bit overkill at this stage specially for my knowledge level. So far Vue and Processwire work very well together. I built some kind of REST api and the performance is very good both for read or to create pages. In some pages I am using regular forms to create posts, users... and in some others I am using vue. Vue of course offers much more potential to build complex, modern interfaces. Great that I can combine both methods. I think Processwire is flexible and powerful enough to build webapps with a smaller learning curve than a full fledged framework such as Laravel. It would be just perfect if creation of APIs for consumption by the front-end would be just a bit easier out of the box. (Is not that the hot keyword of the year? Headless CMS?).1 point
-
If you're looking to do an elaborate a page builder with ProcessWire and don't want to pull your hair out, I highly recommended viewing this video: A couple notes: with the css grid specification, you can assign multiple blocks to the same grid-area but they will overlap each other. I've "overcome" this by combining multiple blocks into a parent div and assigning that instead. pretty easy to do. i didn't demonstrate it, if your blocks have a grid structure within them (like built with flexbox), you can still assign that block to a grid-area. so if your blocks themselves have a grid structure, that's ok. for example, if your css grid layout is 6 columns, but you have a block that has a grid inside of it (built with like uikit's grid that's 5 columns), you can assign that block to the grid-area. with the css grid specification, the flow of the blocks does not have to match the flow of the grid-areas. this is insanely powerful. Enjoy.1 point
-
Almost one click - check out the Batch Child Editor module: http://modules.processwire.com/modules/batch-child-editor/ - either Edit or Replace mode. You could also code an API snippet and store it in the Tracy Console panel snippets list - just run it from the parent page (either on the frontend, or while editing the parent page in the backend - the console will get $page as the page being edited): Or you could use that code in an AdminActions (http://modules.processwire.com/modules/process-admin-actions/) action.1 point
-
Happy New Year to everyone! For a project that I'm working on, I needed to have dependent checkboxes on page edit forms in the admin. Just like dependent selects but for checkboxes. I couln't find anything and decided to write my first Inputfield module. I have only tried it on PW > 3.0. But it should also work on the 2.x branch. Would be great if some of you could try it out and give some feedback. You can find the module InputfieldDependentCheckboxes at github Here's some screenshots of the module in action and instructions on how to use it. ##An Inputfield for ProcessWire admin interface that handles the display of dependent checkboxes in page fields Sometimes we need checkboxes to depend on other checkboxes in our page edit forms. This module adds this functionality to standard page field checkboxes for 2 or more checkbox fields. ## Installation 1. Copy all of the files for this module into /site/modules/InputfieldDependentCheckboxes/ 2. In your admin, go to the Modules screen and click "Refresh". Under the 'Inputfield' section, install the 'InputfieldDependentCheckboxes' module. 3. Open Modules->Configure->InputfieldPage. Under 'Inputfield modules available for page selection' add 'DependentCheckboxes' from the select dropdown and submit ##Field Setup This inputfield extends the standard checkboxes for page fields. Therefore you need to have page fields configured already that you can extend with this Inputfield type. ###Prerequisites You need to have at least 2 fields of type page that have 'Checkboxes' defined as Input field type and live on the same template. A real world example: There are different types of instructors. Each instructor type can have multiple different certifications. For this to happen, we need 2 page fields (multiple): A) instructor_types: lists pages with template 'instructor_type' B) certifications: lists pages with template 'certification' The certification template needs to have the instructor_types page field to assign one or more instructor_types to a certification. ###Setup (link checkbox fields) 1. Edit your page field A and go to the 'Input' Tab. Under 'Input field type' choose 'DependentCheckboxes'. Hit save. Now under 'Choose the target checkboxes field' choose the name of your field B. Hit save again. 2. In your page field b make sure to choose a template under 'Input' Tab under 'Selectable Pages'->'Template of selectable page(s)'. Your fields should be setup. If you now edit a page that contains the 2 fields, the dependent checkboxes should be working. EDIT: And yes, this is working for multiple dependent checkboxes, too. (I have tried it with 3 so far) Some notes on how the module works behind the scenes: - parent checkboxes (actors) that have dependent checkboxes (targets) get custom data attributes applied which contain arrays of the targets' IDs - some Javascript is initiated on acxtors and targets to handle the display based on the id arrays in the data attributes. EDIT: since this module's mention in ProcessWire Weekly it might get some more attention. I just wanted to point out that it is still in alpha state. I will continue development and more thorough testing while implementing it in an ongoing project within the next 3-5 months or so. I will eventually release a stable version then. If you use the module with only 2 dependent checkbox fields, it should work smoothly. There are still some quirks when using 3 or more and I need to figure out how to best resolve them. So please be patient (or jump in with ideas ).1 point