Leaderboard
Popular Content
Showing content with the highest reputation on 06/18/2016 in all areas
-
I made a precompiled edition, here you go : https://github.com/flydev-fr/site-pwbs4/archive/precompiled.zip The installation process is the same, but no command-line or external tools required.5 points
-
The forums are open once again - please note that post content itself will appear very odd for a few more hours whilst the content rebuilds. Please resist the urge to edit any old posts, but please feel free to write new topics and posts Please also note that load times may be a little slow on the forums whilst the background tasks continue to update the old content.5 points
-
Hello, Have you followed the step 4 ? After you uploaded the files, you have to modifiy your code manualy for each file's reference (css / js / font) in your templates. If you dont have any templates then you should at least create one and use it for every page (I mean the basic-page template for example found in the default installation) then create the pages tree. --- I think you should watch this video made by Philipp:4 points
-
1Kb = 8000 bits 1Kib = 8192 bits More info: http://superuser.com/questions/287498/what-is-the-difference-between-a-kibibyte-a-kilobit-and-a-kilobyte4 points
-
Hi ceberlin. According to the original post, the upgrade was rather important to do. It's different, yes. And it may take a while to get used to. But it's something that needed doing3 points
-
Just to follow up, @tpr figured out why the js file wasn't being parsed for him - it's amazing what a single missing space can do His PR has been merged and I have also added support for latte {*TODO this*} style comments. If there are any other comment tag types that anyone needs supported, please let me know.3 points
-
3 points
-
This week we have some nice optimizations and enhancements for the core, as well as some great upgrades in the forums! Our Inputfield forms (including page editor) got a whole lot faster, and our Password field got a ton of nice enhancements. These updates are all available in version 2.8.22 as well. https://processwire.com/blog/posts/upgrades-optimizations-pw-3.0.22/2 points
-
I ran across this problem after I updated to PW 3.0.21 last night. The Automatic Page Name Format stopped working on my PageTable, In PW 3.0.21 it would now ask for the Name of the page I reverted back to PW 3.0.20 and the Automatic Page Name Format works, as it should' If I revert back to PW 3.0.21, it stops working again. Github Issue opened on this problem https://github.com/ryancramerdesign/ProcessWire/issues/18782 points
-
Hi guys, today im sharing new website for a gamin clan, integrated with steam api. Design Piotr Niescioruk @ avenueagency.eu Implementation Paweł Kazubski @ avenueagency.eu Please share your thoughts. http://ctoc.com.pl/2 points
-
Thanks you for trying this profile. I just pushed an update to the css for the responsive menu. Just remove the following code in main.css.2 points
-
I have setup an online test server and uploaded/installed the pre-compiled profile (template) inside a processwire 2.7.2 setup. It looks everything is working well and also nicely responsive. I find this great. I am going to have a look in the back and front end and see how I can change it into some website and learn bootstrap and tether. You can see the online setup here: http://dev9.pe.hu2 points
-
The problem with your approach is, that it only requests the data once and ProcessWire returns all pages instead of those who match the query string. This could be a problem on very dynamic sites, where the content changes often. Here is my solution which solves this: Modify the standard search.php and add if ($config->ajax) { header("Content-type: application/json"); // Set header to JSON echo $matches->toJSON(); // Output the results as JSON via the toJSON function } so the whole file reads <?php namespace ProcessWire; // look for a GET variable named 'q' and sanitize it $q = $sanitizer->text($input->get->q); // did $q have anything in it? if ($q) { // Send our sanitized query 'q' variable to the whitelist where it will be // picked up and echoed in the search box by _main.php file. Now we could just use // another variable initialized in _init.php for this, but it's a best practice // to use this whitelist since it can be read by other modules. That becomes // valuable when it comes to things like pagination. $input->whitelist('q', $q); // Sanitize for placement within a selector string. This is important for any // values that you plan to bundle in a selector string like we are doing here. $q = $sanitizer->selectorValue($q); // Search the title and body fields for our query text. // Limit the results to 50 pages. $selector = "title|body%=$q, limit=50"; // If user has access to admin pages, lets exclude them from the search results. // Note that 2 is the ID of the admin page, so this excludes all results that have // that page as one of the parents/ancestors. This isn't necessary if the user // doesn't have access to view admin pages. So it's not technically necessary to // have this here, but we thought it might be a good way to introduce has_parent. if ($user->isLoggedin()) $selector .= ", has_parent!=2"; // Find pages that match the selector $matches = $pages->find($selector); $cnt = $matches->count; // did we find any matches? if ($cnt) { // yes we did: output a headline indicating how many were found. // note how we handle singular vs. plural for multi-language, with the _n() function $content = "<h2>" . sprintf(_n('Found %d page', 'Found %d pages', $cnt), $cnt) . "</h2>"; // we'll use our renderNav function (in _func.php) to render the navigation $content .= renderNav($matches); } else { // we didn't find any $content = "<h2>" . __('Sorry, no results were found.') . "</h2>"; } if ($config->ajax) { header("Content-type: application/json"); // Set header to JSON echo $matches->toJSON(); // Output the results as JSON via the toJSON function } } else { // no search terms provided $content = "<h2>" . __('Please enter a search term in the search box (upper right corner)') . "</h2>"; } Then call typeahead with the following options: $.typeahead({ input: '#q', order: 'desc', hint: false, minLength: 3, //cache: false, accent: true, display: ['title'], // Search objects by the title-key backdropOnFocus: true, dynamic: true, backdrop: { "opacity": 1, "background-color": "#fff" }, href: "{{url}}", emptyTemplate: "No results for {{query}}", searchOnFocus: true, cancelButton: false, debug: true, source: { //url: actionURL // Ajax request to get JSON from the action url ajax: { method: "GET", url: actionURL, data: { q: '{{query}}' }, } }, callback: { onHideLayout: function (node, query) { $('#searchform').hide(); console.log('hide search'); } } }); The important parts are "dynamic:true" and the "source" configuration so the query string is beeing sent. Now you have a nice AJAX search. EDIT: If you also want to find the query string in other fields than the title make sure you add filter: false to the config of typeahead.2 points
-
This module is improved and extended successor to Version Control For Text Fields. It handles everything it's predecessor did -- providing basic version control features for page content -- and quite a bit more. Download or clone from GitHub: https://github.com/teppokoivula/VersionControl. This module requires ProcessWire 2.4.1 or later, mostly because of the file features, which require certain Pagefile and Pageimage methods to be hookable. There's no sensible way around this limitation; for those stuck with < 2.4.1, Version Control For Text Fields will remain a viable option. What does it do? While editing pages, fields with old revisions available show up with a new icon in their header bars. By hovering that icon you get a list of available revisions and by clicking any one of those the value of that particular field is reverted to that revision. No changes are made to page until you choose a revision and save the page, which means that you can keep switching between revisions to get an idea what's really changed without inadvertently causing any content to change. The module also adds a History tab to page edit. This tab opens a view to the history of current page in the form of "revisions" -- each of which is a group of changes to page fields processed during one page save (similar to revisions in various source control applications). There are three actions you can perform on these revisions: adding comments, live previewing what the page might've looked in that revision and restoring the page to specific revision. One specific feature that has been a big thing for me personally is support for file (and image) fields, as the original version control module felt rather incomplete without it. I'm hoping to take this a lot further performance, stability and feature wise, but as it stands right now, it's already included here and should be fully functional. Watch the video preview here I prepared a little screencast outlining most of this: http://youtu.be/AkEt3W7meic. Considering that it was my first screencast ever, I'd like to think that it wasn't that bad.. but I might give it another shot at some point, this time planning a bit before hitting "record" Upgrading from Version Control For Text Fields For those already using Version Control For Text Fields, I've added something extra. If you upgrade that module to it's latest version, you should see a new checkbox in it's settings screen saying "Don't drop tables during uninstall". If you check this, uninstall the module and then remove it's files (this is required in order to install Version Control), your old data should be automagically imported to Version Control. Import has only been tested with limited amounts of demo data. Proper tests are yet to come, so please be careful with this feature! Update, 21.6.2015: as of today, this module is no longer in beta. While all the regular warnings still apply (making changes, including installing any new modules, on a production site should always be considered risky) Version Control has gone through pretty extensive testing, and should be as stable as any other module out there.1 point
-
Just wanted to share what I recently used to create forms in modules and in frontend using the API and Inputfield modules PW provides and uses on its own. I think many newcomers or also advanced user aren't aware what is already possible in templates with some simple and flexible code. Learning this can greatly help in any aspect when you develop with PW. It's not as easy and powerful as FormBuilder but a great example of what can be archieved within PW. Really? Tell me more The output markup generated with something like echo $form->render(); will be a like the one you get with FormBuilder or admin forms in backend. It's what PW is made of. Now since 2.2.5~ somewhere, the "required" option is possible for all fields (previous not) and that makes it easier a lot for validation and also it renders inline errors already nicely (due to Ryan FormBuilder yah!). For example the Password inputfield already provides two field to confirm the password and will validate it. De- and encryption method also exists. Or you can also use columns width setting for a field, which was added not so long ago. Some fields like Asm MultiSelect would require to also include their css and js to work but haven't tried. Also file uploads isn't there, but maybe at some point there will be more options. It would be still possible to code your own uploader when the form is submitted. Validation? If you understand a little more how PW works with forms and inputfields you can simply add you own validation, do hooks and lots of magic with very easy code to read and maintain. You can also use the processInput($input->post) method of a form that PW uses itself to validate a form. So getting to see if there was any errors is simply checking for $form->getErrors();. Also the $form->processInput($input->post) will prevent CSRF attacks and the form will append a hidden field automaticly. It's also worth noting that processInput() will work also with an array (key=>value) of data it doesn't have to be the one from $input->post. Styling? It works well if you take your own CSS or just pick the inputfields.css from the templates-admin folder as a start. Also the CSS file from the wire/modules/InputfieldRadios module can be helpful to add. And that's it. It's not very hard to get it display nicely. Here an code example of a simple form. <?php $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'subscribe-form'); // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form->append($field); // append the field to the form // create email field $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $form->append($field); // append the field // you get the idea $field = $modules->get("InputfieldPassword"); $field->label = "Passwort"; $field->attr("id+name","pass"); $field->required = 1; $form->append($field); // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Subscribe"); $submit->attr("id+name","submit"); $form->append($submit); // form was submitted so we process the form if($input->post->submit) { // user submitted the form, process it and check for errors $form->processInput($input->post); // here is a good point for extra/custom validation and manipulate fields $email = $form->get("email"); if($email && (strpos($email->value,'@hotmail') !== FALSE)){ // attach an error to the field // and it will get displayed along the field $email->error("Sorry we don't accept hotmail addresses for now."); } if($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { // do with the form what you like, create and save it as page // or send emails. to get the values you can use // $email = $form->get("email")->value; // $name = $form->get("name")->value; // $pass = $form->get("pass")->value; // // to sanitize input // $name = $sanitizer->text($input->post->name); // $email = $sanitizer->email($form->get("email")->value); $out .= "<p>Thanks! Your submission was successful."; } } else { // render out form without processing $out .= $form->render(); } include("./head.inc"); echo $out; include("./foot.inc"); Here the code snippet as gist github: https://gist.github.com/4027908 Maybe there's something I'm not aware of yet, so if there something to still care about just let me know. Maybe some example of hooks could be appended here too. Thanks Edit March 2017: This code still works in PW2.8 and PW3.1 point
-
Bootstrap-4 Minimal site profile for ProcessWire This profile is based on the "minimal site profile (intermediate edition)" and bundled with Boostrap v4.4.1 Features Bootstrap SASS Font-Awesome SASS Render / helper functions for : Simple ul navigation Bootstrap Multi-level navbar Bootstrap Carousel Bootstrap Cards Bootstrap Jumbotron Boostrap Accordion Assets minification, files bundle Dependencies jQuery Popper.js Bootstrap FontAwesome Prequisites You'll want to install the following on your system before proceeding: Yarn / NPM How To Install Download the zip file at Github or clone directly the repo with git clone and skip the step 2. Extract the folder site-pwbs4-master into a fresh ProcessWire installation root folder. During the installation of ProcessWire, choose the profile "ProcessWire Bootstrap 4 profile". After installation You can find the development file (CSS/SCSS/JS) in site/assets/dev/src The profile can be used as is only with $config->debug set to false. To use it in debug mode, you are required to install the dependencies with the package manager. Open a terminal in site/assets/dev and execute the following command-line: yarn Available commands : Rebuild, minify and bundle assets for release : yarn build References Bootstrap v4 documentation ProcessWire documentation ProcessWire Forum: bootstrap tag ProcessWire Forum: bootstrap related posts Credits The ProcessWire staff Inspiration from @gebeer and his Bootstrap 3 profile post Members who contributed in various post about Bootstrap navigation and code (see code-source for refs). Screenshots1 point
-
Basic implementation of the Simple MDE as an Inputfield. https://simplemde.com/ Module developed in reply to request from @OrganizedFellow (https://processwire.com/talk/topic/13474-found-a-handy-js-based-markdown-editor/) Modules Directory: http://modules.processwire.com/modules/inputfield-simple-mde/ Github: https://github.com/outflux3/InputfieldSimpleMDE Editor example: Preview mode: Frontend output (using Markdown/Parsedown textformatter and Image Tags) Limitations etc: This has been tested with multiple instances on 1 page and seems to work fine. Toolbar is not configurable, but you can edit the JS file; In the spirit of keeping this simple, there are no module settings. If you want the spellchecker, you can enable it in the JS file. If is seems that there is a need for configurable instances, it could be added, but so far this works fine and can't see any reason to complicate it further.1 point
-
We will be performing a forum upgrade tomorrow if final testing goes well today. Why are we doing this? The current version is over a year old and the developers have since released a new major version - in fact they're now up to 4.1.x whilst we're still on the 3.x branch. They will not be supplying bug fixes or security patches for much longer. There are a lot of nice changes (and some confusing ones - more on that later) such as responsive design leading to a more complete mobile experience. We can also leverage some caching options to make things even faster when browsing the forums. What does this mean for you? Unfortunately there are a number of down sides to this: The forums will have to be taken offline twice for approx 20-30 minutes each time for several hours. During the upgrade process, the post content gets completely rebuilt and whilst this is in progress things look a mess, code samples look broken etc etc. We think it's better to take it offline than show broken code samples! We've decided to leave the forums open as the forums still technically work, new posts aren't affected, and we need the shop to stay online as well. There will be a learning curve with the new layout, but I'll do my best to post a "this is where to find stuff" post right here after the upgrade. Bizarrely the "best answer" feature has been replaced with a Stack Overflow-style voting feature which doesn't work everywhere we currently have the best answer feature turned on, so we will be making adjustments to some forums. You also can't make the first post in a Q&A forum topic the "chosen answer" which is a bit silly, but I'll be looking for a workaround for that. Possibly the biggest annoyance is that all unread posts you may currently have will get marked as read after the upgrade. Since this forum is a complete rewrite they've been unable (or possibly unwilling?) to do a complete migration of all data to the new version. There are plus sides though, right? Yep, there are: The reason the post content gets rebuilt is so that it's all stored as HTML in the database rather than BBCode that has to be parsed and isn't upgrade-proof. They've also finally stopped using their own-brand post editor and gone with CKEditor, so upgrades should be a little less chaotic as custom tags have been replaced with universally-recognised data-attributes. Theoretically this means that I have less of a headache if they choose to do another complete rewrite in 5 years' time. The code-base has been rewritten and they've removed some of the less used features to speed things up, plus it'll be compatible with PHP 7 soon which means that theoretically everything on the main ProcessWire site can be updated to work with PHP 7 soon and benefit from some nice speed increases. We should be good to stay on the 4.x branch for several years. I'm not anticipating the devs rewriting the codebase for at least another 4-5 years as they've decided to future-proof it as much as possible. Did I mention upgrades will be easier for me to manage in future? Wouldn't it be easier to build a ProcessWire forum module with all the same features? I do think this from time to time, but to be perfectly honest it takes a team of people at least a year to come up with everything you see here. I'm sure I could emulate much of it pretty quickly if I was paid to do it full-time for a year (including BETA testing etc) since the ProcessWire API and module structure is much more sane, but I might also go crazy in the process One day maybe... --- So at some point tomorrow, you will see a message here saying we're upgrading and to check back later. I can't give a precise time estimate, but it is a lengthy process - I would expect it to be at least 6 hours starting around 10am GMT - fortunately most of that is waiting for content to automatically rebuild - and then I have to apply some manual tweaks afterwards which will take about 30 minutes. Schedule TBC - hopefully still tomorrow - some of the final preparations are taking a little longer. Downtime will be kept to 2 blocks of 20-30 minutes maximum if all goes well. Existing post content will look quite odd for the duration, but new posts will be absolutely fine and we'll fix up the old ones afterwards.1 point
-
The Q&A style is probably going to go away for most boards - it certainly doesn't work for example in the Modules/Plugins board.1 point
-
Just a heads up that the newest version (ProcessWire 3.0.22 devns) breaks some things, one of which is module settings fields on some modules, this being one of them (the Placeholder Text field will not save any value). (Still looking into the cause and hope to discover fix soon as it also affects my inputfield modules). **This is now fixed in 3.0.23 devns**1 point
-
Maybe it's a cache issue since you can't get to the admin to do a Modules > Refresh, try emptying the "caches" database table. Sorry you said you already did that I think there is something though in the fact that all your other pages work, just not the homepage and the admin. If you still have no luck, if you PM me access details (FTP and PW login) I'd be happy to take a look for you. Unrelated, but you have a JS syntax error - take a look at the console. PS It seems unlikely, but have there been any changes made to the .htaccess file recently. Did you replace it when you upgraded to 2.7.2?1 point
-
Hi Adrian, Grateful to see you reply, been a follower of your posts for a long time. Like I said, no action in the admin would result in anything, but a simple 404 error. So uninstalling the module was not working either, hence I deleted the files from the file manager, and removed all calls to the module from the template files. Uploaded the template files via ftp, and got this as errors. I have removed the DB table corresponding to ProcessImageMinimize but the error still shows up. On the public front it shows internal server configuration error. I can still log in to the admin, but nothing after that works. Grateful.1 point
-
1 point
-
I don't use frontend editing in PW. It is working fine for me so far. I donated some more bitcoins to Abiosoft as the coin price got so good.. so he will have some compensation for working on the Webtrees rule issue.1 point
-
Same problem. From Pw 3.0.21 Automatic Page Name Format for PageTable field works only if a single template was specified in "Allowed template(s) for children" of parent template settings.1 point
-
I can confirm that. I just finished a wordpress website for a real estate company. I had to do it in wordpress because they already bought the "real homes" template for wordpress and wanted me to use that. During my configuration of the WPML string translation to set their website up in 3 languages I encountered many forums reporting the amount of many database calls WPML is making. Although WPML is doing it's job to translate a wordpress website I find it more like a database hacking solution instead of really translating the website from the cms-database setup. WPML is just another wordpress plugin that you have to install extra next to the other plugins to make things work in wordpress. Processwire has already multi-language in it's cms core and is low on resources The only advantage I see with wordpress is the availability of a lot of nice templates that saves you a lot of design time. I know others have a different opinion about this but hey lets face it: it is not easy to be both a coder and a designer.1 point
-
I play with Rancher environment and custom docker images at the moment and it's fun Created local images and deployed as Rancher stack caddy webserver (PW forum topic) as revproxy (use docker-gen to generate the caddyfile) and web server for PW. php5-fpm container (replaced it quickly with php7-fpm for short testing PW 3 with php7) openssh (used as sftp / scp and optional ssh access to the "webspace" = docker volume) Works fine with HTTPS (frontend, ssl offloading) and http in the backend / internal container). Tested PW frontend, backend, image upload and content editing ...). Because playing with docker is fun... I use RancherOS (OS with docker as pid 1), a custom kernel and custom desktop images (xorg, dbus, volumeicon, pcmanfm, chromium, ...) as "Docker Desktop"... but I should find the way back to PW soon because I'll create a new website in the near future...1 point
-
I'll think about if the config setting is necessary, maybe others could drop in their thoughts on this. Did you read the last sentence in my previous post? Just edited the post while you replied.1 point
-
Thanks! As for js/css comments: silly me, they are stripped on minification My source files are one dir up from /site dir, maybe that's why their comments are not showing up? But there was an umninified Js file whose comment was shown before the update (baguetteBox.js), and it's in site/scripts folder.1 point
-
Thanks, it's much readable this way. Some quick tests for comments: PHP: OK ("//") Latte: aren't shown ("{*todo this is Latte comment*}") JavaScript: ("//"): seems not picked up CSS: nope ("/*todo what is this?*/") SCSS: nope ("//todo what is this?") Maybe the panel title could be more readable by removing the brackets. Also there's no space between the words now: "ToDo(0/3)". My suggestion would look like "ToDo 0/3"1 point
-
1 point
-
Sure, I'd be glad to elaborate. Here's the outline of the update process: Update the MLS, processing each property type and property status individually for flexibility Get layout of RETS parent class (In my case Property) and RETS listing type tables (In my case A, B, C, and D) using GetClassesMetadata and GetTableMetadata Populate list of available MLS entries with only MLS, internal ID, and modification timestamp. $connection->Search('Property', 'A', '(LIST_15=ON6KCGQ87YK),(LIST_104=Y),(LIST_12=2013-06-02+)', ['Select' => 'LIST_1,LIST_105,LIST_87','Limit' => 'NONE']) The LIST_15 part of the query is a filter for status. Sadly, RETS makes heavy use of lookup fields, so you have to find the code for the value you want on the lookup table before you can find the value to use for the query. Fortunately, this is only an issue for field values used in the RETS queries themselves. Delete listing pages that no longer exist on the MLS For each listing without pages or each listing with a changed timestamp { Populate MLS data using data collected by querying for all fields from only the one property Update all photos if the photo timestamp changed (iterate the media using a GetObject -- PHRETS makes this easy) Update all documents if the document timestamp changed (mostly the same as with photos) Precache the resized images of random listings Precache the long-lived WireCache snippets of random listings Aggressively delete unused asset files, including unneeded and obsolete image sizes. 10 GB of photos and documents is plenty. This code also forces a photo update if photos are missing. Delete expired log files Prerender homepage and pages linked from it with ProCache curl -sS `curl -sS https://website.com/|grep -oE 'listings/([a-z]+)/([a-zA-Z0-9-]+)/|quick-search/([a-zA-Z0-9-]+)/'|sed -e 's/^/https:\/\/website.com\//'|sort|uniq` >/dev/null I'm sure there's so much I missed; I'll be doing well if this even makes sense! One thing I didn't cover above is the replay mechanism. If I make a change to RETS value parsing, I can easily run a complete offline update using the cached JSON data from each listing. It's a big timesaver.1 point
-
Thanks as always for this! One problem though that I encountered was that the new version (.22) broke my custom inputfield (InputfieldSelectize), the inputfield seemed to no longer save or load the strings that define the array and option/items markup and then that caused all pages using that to break. is there something that would prevent either storing or loading data into those settings fields (??) Update: The module config data (for each field) is saved to the database, but is not being loaded into the field editor fields when the page renders. This happens on the following modules tested so far: Inputfield Chosen Select Inputfield Selectize Selectize Template & Field Tags if anyone has any clues how to fix this, would be appreciated! I spent some time to look at this but sort of striking out at this stage...1 point
-
A like is not enough! This is just awesome and opens up so many possibilities for page inputfield UI. :)1 point
-
InputfieldSelectize A Inputfield to provide a select interface for Processwire CMS FieldtypePage using the (awesome) Selectize.js jQuery plugin, by Brian Reavis. Selectize: https://github.com/selectize/selectize.js Modules directory: http://modules.processwire.com/modules/inputfield-selectize/ Github: https://github.com/outflux3/InputfieldSelectize Features Custom designed options and items for any page select field. Your select options can use any field or subfield on the page, but also sub-subfields, or any data you provide, since you are not limited by tag replacement: you control the precise data supplied to the options using a PHP array that returns data to the module, which is in turn supplied in JSON to the select as adata-dataattribute. The plugin uses the JSON object for each option meaning you can do whatever you want with that data in designing your options/items. Each instance lets you define which fields are searchable for the select Your selects can use display logic based on the value of any field/data item, for example using ternery conditionals you can avoid empty parenthesis. You can design the options and items (what is seen once an option is selected) independently of each other. Therefore you could have special fields on the options for searching, but exclude those on the item. Likewise you can show elements on your item like an edit button which is not needed on the option. Multiselect pages are sortable, and deletable by backspace or optional remove button. When AceExtended editor is installed, the module will use that for the code input fields. Usage Install the Module Edit your pagefield and choose InputfieldSelectize as inputfield. You will see the empty fields that need to be populated to make this work Notes For examples of what you can do (in general) with your selects when using Selectize.js, view the plugin site at http://selectize.github.io/selectize.js/. The plugin theme is selected on the required JquerySelectize module ----- Examples Basic Example PHP (the data array for each item - this must return a plain array): $data = array( 'title' => $page->title, 'company' => $page->company_select ? $page->company_select->title : 'Not set', 'total' => count($page->recipients), 'editUrl' => $page->editUrl ); return $data; Javascript (item and option same) Here, the item.property each refer to the keys of the PHP array that you returned in the above field. This field must be a valid Javascript string with each of the properties you want to show as demonstrated below, and recommended to use the escape(item.property) syntax. These strings are passed to the render functions of the plugin. '<div class="item">' + '<span style="display:block;font-size:14px;font-weight:bold;">' + escape(item.title) + ' (' + escape(item.total) + ')</span>' + '<span>' + escape(item.company) + '</span>' + '</div>' Example screenshot: A more advanced example This example shows how to use conditionals for the PHP and JS to get the select options to look clean and provide the necessary information to assist users in choosing the correct options: PHP $data = array( 'title' => $page->title, 'year' => $page->year ?: $page->year_sort, 'for_inst' => $page->for_inst, 'edit_href' => $page->editUrl ); return $data; Item Javascript: '<div class="item">' + '<div style="color: black; font-size: 14px;"><span style="font-weight:bold;">' + escape(item.title) + ' (' + escape(item.year) + ')</span>' + ' <a class="pw-modal pw-modal-medium" href="' + escape(item.edit_href) + '">Edit <i class="fa fa-edit"></i></a></div>' + (item.for_inst ? '<div style="color:gray;">for ' + escape(item.for_inst) + '</div>' : '') + '</div>' Option Javascript: '<div class="item" style="width:100%;">' + '<div style="color: black; font-size: 14px;"><span style="font-weight:bold;">' + escape(item.title) + ' (' + escape(item.year) + ')</div>' + (item.for_inst ? '<div style="color:gray;">for ' + escape(item.for_inst) + '</div>' : '') + '</div>' Example with images In this example the selects will feature a thumbnail image: You could also set the width of the selected item to 100% depending on where you place the field (e.g. in a column) $image = $page->images->first(); $thumb = $image->size(100,100); $data = array( 'title' => $page->title, 'thumb_src' => $thumb ->url, 'img_dims' => $image->width . 'x' . $image->height, 'img_desc' => $image->description, 'img_size' => $image->filesizeStr, 'edit_src' => $page->editUrl ); return $data; '<div class="item" style="width:100%;">' + '<div class="image-wrapper" style="float:left;"><img src="' + escape(item.thumb_src) + '" alt=""></div>' + '<div class="info-wrapper" style="float:left; padding:5px;">' + '<span style="font-size:14px;font-weight:bold">' + escape(item.title) + '</span><br>' + '<span>Dimensions: ' + escape(item.img_dims) + 'px</span><br>' + '<span>Filesize: ' + escape(item.img_size) + '</span><br>' + '<span>' + escape(item.img_desc) + '</span><br>' + '<a class="pw-modal pw-modal-medium" href="' + escape(item.edit_src) + '">Edit <span class="ui-icon ui-icon-extlink"></span></a></div>' + '</div>' '<div class="item">' + '<div class="image-wrapper" style="float:left;"><img src="' + escape(item.thumb_src) + '" alt=""></div>' + '<div class="info-wrapper" style="float:left; padding:5px;">' + '<span style="font-size:14px;font-weight:bold">' + escape(item.title) + '</span><br>' + '</div>' + '</div>' Current Notes & Issues: Works with 3.0.23 devns Doesn't currently support creating new options (and may exhibit strange behavior if you try and add one not in the list) Doesn't yet support optgroups1 point
-
If the order is your issue than use count() with those selectors, the current page num and some math to determine which pages are to be shown on the current page - then load just those. Edit: I've not tested it with real pages, but the test class seems to work correctly: https://github.com/LostKobrakai/Paginator1 point
-
For the time being it's fine to use 2.7.2 – that's our latest stable release after all – but if you're just now starting a new project, and especially if it's going to be under development for a while, I'd strongly suggest basing it on either 2.8 or 3.x devns. If you're feeling slightly adventurous and choose to go with 2.8 or 3.x, the choice between these two depends mainly on whether you plan to make use of external libraries etc. in your project. 3.x includes namespaces, 2.8 doesn't – other than that they're essentially the same and will remain so thanks to the fact that Ryan has mostly automated the process so that updates to 3.x also get applied to 2.8. While namespaces are cool for serious development and can make it a) easier to pull external libraries into ProcessWire or b) pull ProcessWire into other projects, in my experience most site projects don't benefit much from them. If the idea of namespaces makes you uncomfortable and/or you have no idea what they are, it's absolutely fine to go with 2.8. For the most part the built-in FileCompiler in 3.x hides namespaces from plain sight, but if you just want to build a regular site with ProcessWire and don't want to worry about all that namespace stuff at all, you'll probably feel more at home with the 2.x branch1 point
-
Since I didn't see it mentioned in any changelogs, I just want to give a heads up to the new ability to import field values via JSON files, which @justb3a implemented in top notch quality after my fiddly proof-of-concept patch . I find this to be a major improvement, since it enables so much easier import of data from e.g. Drupal, so just wanted to make you all aware of it. I have outlined in very broad broad terms how I went about transferring data from a Drupal 7 site, to processwire, in this post.1 point
-
Whew! I got help from Caddy developer abiosoft and now I have a working ProcessWire config! It is included below. Note certain things: - the "php" in the fastcgi line defines a preset, so we don't need to use any "ext" stuff. - the new style rewrite which does not use {uri}: to {path} {path}/ /index.php?it={path}&{query} Abiosoft is also looking into a webtrees instance I have. So far the routing is solved by a workaround of adding a /slash to a certain line the webtrees index.php. Once the issue is solved properly, I can publish the Caddy config on the webtrees forum I urge everyone using Caddy with PW to donate bitcoins to abiosoft! https://mysite.com, https://www.mysite.com { root /wherever/your/files/are fastcgi / unix:/var/run/php-fpm/php-fpm.sock php internal /forbidden rewrite { r /\. to /forbidden } rewrite { r /(COPYRIGHT|LICENSE|README|htaccess)\.txt to /forbidden } rewrite { r ^/site(-[^/]+)?/assets/(.*\.php|backups|cache|config|install|logs|sessions) to /forbidden } rewrite { r ^/site(-[^/]+)?/install to /forbidden } rewrite { r ^/(site(-[^/]+)?|wire)/(config(-dev)?|index\.config)\.php to /forbidden } rewrite { r ^/((site(-[^/]+)?|wire)/modules|wire/core)/.*\.(inc|module|php|tpl) to /forbidden } rewrite { r ^/(site(-[^/]+)?|wire)/templates(-admin)?/.*\.(inc|html?|php|tpl) to /forbidden } # GLOBAL rewrite { to {path} {path}/ /index.php?it={path}&{query} } log /var/log/www/access.log { rotate { size 50 age 7 keep 5 } } errors { log /var/log/www/error.log { size 50 age 7 keep 5 } } }1 point
-
I was put on to Mandrill by Pete (thank you Pete). In my experience if your website sends emails to people, for example you have a booking app and people get confirmations, then the confirmation emails may, sometimes, get rejected as spam, regardless of the fact that they're not. TL;DR Whenever in the PW admin there is a field to do with delivery of email from PW, there ought to be a note / link to an article about the benefits of sending email via Mandrill (or similar service) rather than direct. Boring rant version I had tried to solve this lack of 100% reliable email delivery with DKIM and SPF records (good things in their own right) tuning the content of the email so perhaps it would be less likely to apparently trigger some spam pattern recognition code (for example having few(er) HTML links banging my head shouting Nothing worked. I would appear to have a period of reliability where all emails were getting through, relax... Then BAM! Another spam rejection. The only variance? The receiving email systems. As visitors to the site were many and varied so were their email systems and some of those email systems spam detection algorithms were simply too sensitive for their own good. So it was not my fault but nevertheless my client whose website used the booking system kept gettings infrequent but repeated 'lost' email confirmations. So I made one other change, I sent email via SMTP to Mandrill rather than directly to the client. Mandrill then sent it to the client. This resulted in an unprecedented (and continuing) period of 100% success—zero false positive spam rejections. The reason is simple: my client's domain (or your client's domain) has a reputation as a source of email. It is probably average or good. Whereas Mandrill, who send (Mandrill is part of MailChimp and these are the overall numbers) with this many emails have to have an exceptional reputation, and they do. Nothing I can do on a domain or in DNS can compete with this firehose of good reputation provided by Mandrill. Recommendation If I were a newbie to emailing from PW to people then I could well go through this learning curve myself. To help others I would like to suggest that perhaps wherever there is a field in PW that is responsible for sending email that one of those helpful 'Notes' be auto populated with a link to an article on on the benefits of sending email via an intermediary such as Mandrill.1 point
-
Maybe this can be useful to people. It replaces a normal textarea in the backend with an ace instance. class AdminHelper extends WireData implements Module{ const phpFirstLine = "<?php //autmatically added but not saved"; public function init() { // Inputfield Ace Extended for editing page fields $this->addHookAfter('InputfieldPage::getConfigInputfields', $this, 'makePHPFieldACEField'); $this->addHookBefore('ProcessField::executeSave', $this, 'removeLeadingTag'); } public function makePHPFieldACEField($event){ $form = $event->return; $field = $form->get("findPagesCode"); $ace = $this->modules->get("InputfieldAceExtended"); // foreach (get_object_vars($field) as $key => $name) { // $obj->$key = $name; // } $ace->setAttributes($field->getAttributes()); $ace->setArray($field->getArray()); $ace->modes = array("php"); $linecount = substr_count($ace->attr("value"), "\n"); // Preserve collapsed mode and do not add when build for saving if($ace->attr("value") !== "" && !$this->input->post->findPagesCode) $ace->attr("value", self::phpFirstLine."\n\n".$ace->attr("value")); $ace->rows = $linecount ? $linecount : 4; $field->parent->insertAfter($ace, $field); $field->parent->remove($field); $event->return = $form; } public function removeLeadingTag($event){ if($this->input->post->findPagesCode && strpos($this->input->post->findPagesCode, self::phpFirstLine) !== false){ $this->input->post->findPagesCode = trim(str_replace(self::phpFirstLine, "", $this->input->post->findPagesCode)); } } }1 point
-
People, this is really awesome! When I started this little project I had a little hope for community contributions a) because of the vibrant PW community and b) the modular architecture of Symfony Console, but I would have never expected this growth within a month. Big thanks to all contributing and fixing commands and ideas! @horst: Bam! Delivered! Cheers! I'll look into it, merge it soon and will establish a proper namespace for the growing number of helper classes. One more thing: I hate to have hobby horse projects without at least a rudimentary logo1 point
-
Here are some API additions to the dev branch, primarily for WireArray/PageArray/etc. I've found these very handy lately, and would have on almost any project I worked on, so decided they'd add value to the core. I'll add these to the cheatsheet once 2.4 replaces 2.3, but for now, here they are. The examples here use PageArray, but note that these API additions apply to any WireArray derived type, not just PageArray. WireArray::implode() Implode all elements to a delimiter-separated string containing the given property from each item. Similar to PHP's implode() function. Usage: $string = $items->implode([$delimiter], $property, [$options]); Arguments: $delimiter - The delimiter to separate each item by (or the glue to tie them together). May be omitted if not needed $property - The property to retrieve from each item (i.e. "title"), or a function that returns the value to store. If a function/closure is provided it is given the $item (argument 1) and the $key (argument 2), and it should return the value (string) to use. [$options] - This argument is optional. When used, it's an array with modifiers to the behavior: skipEmpty: Whether empty items should be skipped (default=true) prepend: String to prepend to result. Ignored if result is blank. append: String to prepend to result. Ignored if result is blank. Examples: $items = $pages->find("template=basic-page"); // render all the titles, each separated by a <br>, for each page in $items echo $items->implode('<br>', 'title'); // render an unordered list of each item's title echo "<ul><li>"; echo $items->implode('</li><li>', 'title'); echo "</li></ul>"; // same as above, but using prepend/append options, // this ensures no list generated when $items is empty echo $items->implode('</li><li>', 'title', array( 'prepend' => '<ul><li>', 'append' => '</li></ul>' )); // same as above, but with all items now presented as links // this demonstrates use of $property as a function. note that // we are also omitting the delimiter here as well, since we don't need it echo $items->implode(function($item) { return "<li><a href='$item->url'>$item->title</a></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>')); WireArray::explode() Return a plain array of the requested property from each item. Similar to PHP's explode() function. The returned PHP array uses the same keys as the original WireArray (if that matters). Usage: $array = $items->explode($property); Arguments: $property - The name of the property (string) to have in each array element (i.e. "title"). You may also provide a function/closure here that should return the value to store. When a function/closure is used it receives the $item as the first argument and the $key (if needed) as the second. Examples: // get an array containing the 'title' of each page $array = $items->explode('title'); // get an array containing the id, url and title of each page $array = $items->explode(function($item) { return array( 'id' => $item->id, 'url' => $item->url, 'title' => $item->title ); }); WireArray::data() Store or retrieve an arbitrary/extra data value in this WireArray. This is exactly the same thing that it is jQuery. I've personally found this useful when building search engines: the search engine can store extra meta data of what was searched for as a data() property. Then any other functions receiving the WireArray/PageArray have access to this additional info. For example, the search engine portion of your site could populate an array of summary data about what was searched for, and the render/output code could render it to the user. Usage: // Setting data $items->data('key', 'value'); // Getting data $value = $items->data('key'); // Get array (indexed by key) of all data $values = $items->data(); Arguments: The above usage section explains all that's needed to know about the arguments. The only additional comments I'd make are that 'key' should always be a string, and 'value' can be anything you want it to be. Example: function findSkyscrapers() { $floors = (int) wire('input')->get->floors; $year = (int) wire('input')->get->year; $items = wire('pages')->find("template=skyscraper, floors=$floors, year=$year"); $items->data('summary', array( 'Number of floors' => $floors, 'Year constructed' => $year )); return $items; } // the render function can focus purely on output function renderSkyscrapers($items) { echo "<h2>You searched for:</h2>"; // render the summary of what was searched for foreach($items->data('summary') as $label => $value) { echo "<p>$label: $value</p>"; } echo "<h3>Skyscrapers found:</h3>"; // note use of new implode() function, though a foreach() would be just as well here echo $items->implode(function($item) { return "<p><a href='$item->url'>$item->title</a></p>"; }); } WireArray::and() WireData::and() Return a new copy of the WireArray with the given item(s) appended. Primarily as a syntax convenience for various situations. This is similar to jQuery's add() and andSelf() functions, but I've always felt "add" implied adding something to the original rather than creating a new combination, so went with "and" in this case. The term "and" is actually a reserved word in PHP, so you can't usually have a function named "and()", but through the magic of hooks, ProcessWire can. This function should reduce the instances in which you'd need to do "$a = new PageArray();" for example. Usage: // create a new WireArray with $items and $item (appended) $myItems = $items->and($item); // create a new WireArray with $items and $moreItems (appended) $myItems = $items->and($moreItems); // create a new WireArray with $items and $item (prepended) $myItems = $item->and($items); // create a new WireArray with $item and $anotherItem (appended) $myItems = $item->and($anotherItem); // create a new WireArray 4 items $family = $pappa->and($mamma)->and($brother)->and($sister); Examples: // generate breadcrumb trail that includes current page foreach($page->parents->and($page) as $item) { echo "<a href='$item->url'>$item->title</a> / "; } // check if page or its children has a featured checkbox if($page->and($page->children)->has("featured=1")) { echo "<p>Featured!</p>"; }1 point