Leaderboard


Popular Content

Showing most liked content since 05/28/2017 in all areas

  1. 18 likes
    I just returned back in town about 30 minutes ago, after being out of town with the family most of this week. As a result, I've got no blog post for this week. I'd hoped to at least get the email newsletter out, but unfortunately didn't have the necessary internet access to do so. Thankfully back online now. I'll be sending out a double issue of the newsletter next week. Hope that everyone had a good week and has a great weekend!
  2. 18 likes
    Adds a Service Worker to your Processwire site which can be customised. The service worker script itself is heavily based on Jeremy Keith’s work – thank you Jeremy! More information: https://github.com/johannesdachsel/processwire-serviceworker
  3. 14 likes
    This week’s core version on the dev branch includes a lot of small fixes and improvements. We’ve also got a new multi-language URL field available this week as well. https://processwire.com/blog/posts/processwire-3.0.65-core-updates/
  4. 13 likes
    This week we take a closer look at the useful new page export/import functions that we’re currently building into the core: https://processwire.com/blog/posts/a-look-at-upcoming-page-export-import-functions/
  5. 13 likes
    I actually think for this module the client expressed interest in us releasing it available for others to use once it's finished. I will confirm though. I used the process outlined on this page (link) to do a lot of it, though admittedly there was also a lot of stuff to figure out with some trial and error.
  6. 12 likes
    Hi everyone, I'm proud to share my first fieldtype module and I think it's a quite handy one It helps you to create all kinds of table/matrix inputs very quickly and easily. You have loads of options for customizing your field via plain javascript. See the handsontable docs for that Download: https://gitlab.com/baumrock/FieldtypeHandsontable Result: Installation/Configuration: Just install the Fieldtype, add a field to your template and set the handsontable options in the fields details. If you have InputfieldAceExtended installed you will also have code highlighting for your code: Get data: If you retrieve the data from the API with outputformatting ON you have some helper methods available: getData() + getRows() get all data of the field getRow($row) get one special row, eg getRow(1) or getRow("2017") getCols() get all data but by columns not by rows getCol($col) get one special column, eg getCol(1) or getCol("mycolumnheader") You can also access rowHeaders and colHeaders directly (see examples) Simple Example: Result: Field config: var colheaders = ['Jan', 'Feb', 'März', 'Apr', 'Mai', 'Juni', 'Juli', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez']; hot.updateSettings({ colHeaders: colheaders, minCols: colheaders.length, maxCols: colheaders.length, rowHeaders: false, minRows: 1, maxRows: 1, }); Get data: Example with rowheaders: var colheaders = ['Jan', 'Feb', 'März', 'Apr', 'Mai', 'Juni', 'Juli', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez']; var rowheaders = [2017, 2018, 2019]; hot.updateSettings({ colHeaders: colheaders, minCols: colheaders.length, maxCols: colheaders.length, rowHeaders: rowheaders, minRows: rowheaders.length, maxRows: rowheaders.length, }); Use data from the server-side: You can do all kinds of stuff with the table when communicating with your backend via the pw js() function: // inside /site/ready.php if($page->template == 'admin') { $paths = $pages->find('include=all, limit=10')->each('path'); $config->js('demodata', $paths); } var colheaders = ['one', 'two', 'three', 'four']; var rowheaders = ProcessWire.config.demodata; hot.updateSettings({ rowHeaders: rowheaders, minRows: rowheaders.length, maxRows: rowheaders.length, colHeaders: colheaders, minCols: colheaders.length, maxCols: colheaders.length, rowHeaderWidth: 250, }); You get the idea Please consider this module ALPHA until i got some more time to test it. Any help would be highly appreciated Numbers are for example always tricky. Different locale settings, different types, rounding errors and so on...
  7. 12 likes
    This little tipp is not especially for PW, its for all usages. There is a little class called php-store-hours which can be used to easily format opening hours. It is also possible to group days with the same hours like in schema.org markup. There are a lot of render functions available to get the markup that you want. Just take a look. Maybe it is something you are looking for. Best regards Jürgen
  8. 11 likes
    Variations Released 29 May 2017 Variations is a simple yet powerful commercial ProcessWire module that allows website editors to create attributes and their values and from those generate variations of any entity, most notably products. The module consists of FieldtypeVariations and InputfieldVariations as well as a ProcessVariations for managing variations configurations and attributes. Setting up the field is quite easy. First, create a field of type Variations. Define some custom inputs that will need to be directly edited on the page containing the field, for instance a product price, SKU, etc. Secondly, via the Inputfield, create a couple of attributes. Thirdly, create a variations configuration and add the attributes and values you want in the configuration. Link that variations configuration to your page and the module will automatically generate all possible combinations (variations) of the attribute values in that configuration. These, together with the custom inputs you created when setting up the field will be displayed on the page (e.g. a product page), ready for editing. This makes this module quite unique; variations are defined at the page-level rather than at the field level. This presents lots of possibilities such as infinitely reusable attributes and variations configurations. For those using Padloper, integration with the e-commerce platform is quite simple as demonstrated in this tutorial. The module consists of 4 modules ProcessVariations FieldtypeVariations InputfieldVariations VariationsCustomTableManager (autoload module, working behind the scenes) Video Demo: https://youtu.be/T93nn96UL8o Documentation: https://variations.kongondo.com/ Shop: https://processwireshop.pw/plugins/variations/ Requires: ProcessWire 2.5 or newer Features Easily create variations of anything, including products for e-commerce websites, etc Create an attribute once, use it everywhere, multiple times, picking and choosing all or only the attribute values you want Bulk editing of variations configurations and attributes Reusable variations configurations Works with Padloper out-of-the-box with minimal coding User-friendly, intuitive and easy to set up
  9. 11 likes
    A proof-of-concept module. ImageToMarkdown Alt+click an image in Page Edit to copy an image markdown string to clipboard. Usage Install the ImageToMarkdown module. Alt+click an image in Page Edit to copy an image markdown string to clipboard. If the "Description" field is populated it is used as the alt text. https://github.com/Toutouwai/ImageToMarkdown
  10. 10 likes
    Yesterday we (Peter & Paul) launched two websites, Noiascape & Factory. Both a labour of absolute love. We are extremely proud of these and even more proud that our clients share our love for ProcessWire. Thanks for all your great work Ryan! Noiascape An architectural company based in London, Teatum & Teatum, came to us asking for a very different website promoting their unnamed development practice. Teatum & Teatum's creativity influences their buildings, we wanted to capture that in the name, brand & website we created. The name we came up with was Noia/Scape. Noia means new thinking, new approach and new direction. Scape means space, landscape, communities and places. http://www.noiascape.com Factory A multi-award winning sound design and audio facility in London, worked with us to come up with a creative idea to celebrate their 20th Anniversary. The original idea to reskin their website, turned into a rebuild using ProcessWire due to the massive improvement that ProcessWire could bring. Both to the front-end and the back-end. Factory are extremely happy with ProcessWire and are really glad they made the switch. It's always exciting when clients share our passion for ProcessWire. The main piece of work was to create art from sound and use this for a timeline of Factory's history. http://factory.uk.com Thanks Ryan & Community for all your great work and allowing front-end developers such as myself feel limitless when creating websites.
  11. 10 likes
    I'd hate to know how much accumulated time I have spent and how much eye-strain I have experienced over the last couple of years, hunting through the 675 icons in the "all icons" view for the one I want. Today I finally got around to doing something about it. IconsFilter Allows the "all icons" view in InputfieldIcon to be filtered by name. Usage Install the IconsFilter module. When viewing "all icons" in InputfieldIcon (Advanced tab of field/template settings) you can filter the icons by name using the filter input at top right. https://github.com/Toutouwai/IconsFilter @tpr, something that could be merged into AdminOnSteroids?
  12. 10 likes
    Hello, I want to showcase my website made in processwire. https://chrysemys.nl/ Goal of the website There are quit some websites with information about turtles. Most of them are very limited in information. This website main goal is to be very complete in information. Information about turtles, there natural behaviour, detailed descriptions. Next is also associations ( (bi-)directional links) with caresheets, books, food, illnesses, etc... Second goal is to learn PHP as I started an education for application engineering 4 months ago. Setup It is build on the latest version (3.0.61) and makes use of the latest template strategy. I use the pw-append, pw-replace classes in combination with _main.php and several template files. Most of the rendering is done from custom functions in _functions.php. In the back-end the pages are styled with the options for visibility and group in logical blocks. This is a very nice feature with processwire and makes the pages easier to fill. Next to the core modules I have used the following extra modules: AIOM+ - obviously Connect Page Fields - This module is very important. The whole site is considered a relational database. The base is the enity turtle. This entity has bidirectional associations with books, caresheets, locations (voor google maps), regions (to group locations), the different classifications of the animal taxonomy, food, etc. To make these kind of associations it greatly simplified the output on the other templates. This module was a mandatory feature for being able to create a site as I wanted to. Otherwise it would it would be very inefficient to keep everything up to date. Now I can add a new book and connect it to one ore more turtles. After the save you can see the book also on the turtle page. This goes for all the bidrectional links. This page is about a species - https://chrysemys.nl/schildpadden/emys-orbicularis/ This species has several sub species (basicly the same turtle but live in another country/region and has some different charasteristics). I have decided to make no distinction between species and sub species (on a template level) and use this module to connect them to each other. One reason was that this way the url would not be too long. This turtle lives in several different habitats. These are also bidirectional associations. The same goed for food, books, food to mention some. The biological taxonomy is also build this way as entities that have no parent/child relation. They are connected to each other with page reference (in this case). Both methods (page reference or parent/child) have their pro's and cons, in the end this setup seemed to work best for me. Map Marker - This is used for the map marker field for the locations (verspreiding). Everyt turtle can live in one ore more locations and the will show up on the google map. Also I have the possibility to add location specific information about the climat on the pages (missing on almost all other websites). Map Markup (Google Maps) - For the output of the google map. The js script for this is only outputted on the pages where it is used (template strategy). Markup Sitemap XML - obviously Social Share Buttons - Added this as it is recommended for a better SEO score. Get Video Thumbnails - The blog story can have a youtube link. This module automatically grabs an image and places it as the image for the blog. No more extra steps needed. Video embed for YouTube/Vimeo - I slight changed the output for this module so it always is placed under the body. Datamaps.js - Also I had some very important help from @adrian with help of using datamaps.js. This page is a datamaps script that read all turtles that live in the US and shows them in the correct state. https://chrysemys.nl/kaart-verenigde-staten/ A php function renders the output for the script and fills the variables. These are added to te script on rendering the page. The website is not finished and probably never will be as new information and functionality will be added all the time. But it is finished enough to serve as a showcase. Roadmap There are several things I want to add in the future: A find selector for overview pages (select by size, region, family, etc). Worked on this but, could not get it working. Datamaps.js for all regions (also with a selector to select another region). Optimize the queries to make the site faster. Several front-end improvements (marging/padding/font-size, etc...)
  13. 9 likes
    ProcessWire does have an router, even though it does look vastly different to what you're talking about. It's routing requests by the page template to the corresponding template.php file. What you proposed does not correspond very well with that core routing strategy, because neither urls nor the http methods are the identifying factor here. It's the pages template and the existence in the page tree. If you're looking for a more traditional mvc routing layer, you can set an alternative template file for your templates (by hook or in the backend). Just point all of them to e.g. a router.php file and use whatever router package your like to route requests to wherever the action should be handled. And about the core routing of processwire. Always keep in mind that mvc frameworks do not have something like the page tree, which is why they need a router to work on the url of the request. ProcessWire does not need that with it's approach.
  14. 9 likes
    This is my second project based on processwire. I love it. Please share your meanings http://baumaschinen.guru
  15. 8 likes
    First a note about my other modules... I have three existing modules that are similar in that they allow restrictions to be placed on repeating inputfields: Limit Repeater, Limit PageTable, Limit Table Restrict Repeater Matrix takes a different approach to the module configuration from those other modules. The module settings for Restrict Repeater Matrix are applied in the field settings rather in a module config screen. I think this new approach is better, but it means that it isn't practical to create different settings for different roles via the admin interface. Instead the module has a hookable method, allowing roles to be targeted and other advanced usages to be achieved via a hook. The result is that the module is more flexible. I intend to transition my other modules to the same approach over the coming weeks, but because this will result in breaking changes I will be releasing the updated modules under new names ("Restrict Repeater", etc) to avoid users upgrading via the Upgrades module without full awareness of the changes. The old modules will be marked as deprecated. Restrict Repeater Matrix A module for ProcessWire CMS/CMF. Allows restrictions and limits to be placed on Repeater Matrix fields. For any matrix type in a Repeater Matrix field you have the option to: Prevent drag-sorting of items Prevent cloning of items Prevent toggling of the published state of items Prevent trashing of items Limit the number of items that may be added to the inputfield Please note that restrictions and limits are applied with CSS/JS so should not be considered tamper-proof. Usage Install the Restrict Repeater Matrix module. For each matrix type created in the Repeater Matrix field settings, a "Restrictions" fieldset is added at the bottom of the matrix type settings: For newly added matrix types, the settings must be saved first in order for the Restrictions fieldset to appear. Set restrictions for each matrix type as needed. A limit of zero means that no items of that matrix type may be added to the inputfield. Setting restrictions via a hook Besides setting restrictions in the field settings, you can also apply or modify restrictions by hooking RestrictRepeaterMatrix::checkRestrictions. This allows for more focused restrictions, for example, applying restrictions depending on the template of the page being edited or depending on the role of the user. The checkRestrictions() method receives the following arguments: $field This Repeater Matrix field $inputfield This Repeater Matrix inputfield $matrix_types An array of matrix types for this field. Each key is the matrix type name and the value is the matrix type integer. $page The page that is open in ProcessPageEdit The method returns a multi-dimensional array of matrix types and restrictions for each of those types. An example of a returned array: Example hooks Prevent the matrix type "images_block" from being added to "my_matrix_field" in a page with the "basic-page" template: $wire->addHookAfter('RestrictRepeaterMatrix::checkRestrictions', function(HookEvent $event) { $field = $event->arguments('field'); $page = $event->arguments('page'); $type_restrictions = $event->return; if($field->name === 'my_matrix_field' && $page->template->name === 'basic-page') { $type_restrictions['images_block']['limit'] = 0; } $event->return = $type_restrictions; }); Prevent non-superusers from trashing any Repeater Matrix items in "my_matrix_field": $wire->addHookAfter('RestrictRepeaterMatrix::checkRestrictions', function(HookEvent $event) { $field = $event->arguments('field'); $type_restrictions = $event->return; if($field->name === 'my_matrix_field' && !$this->user->isSuperuser()) { foreach($type_restrictions as $key => $value) { $type_restrictions[$key]['notrash'] = true; } } $event->return = $type_restrictions; }); https://github.com/Toutouwai/RestrictRepeaterMatrix
  16. 8 likes
    @ryan, stuff like this is super-interesting to us aspiring devs and I for one would give my right arm to take a peek at your code and see how an expert approaches these things. It would be a really great learning opportunity. In general, would your client contracts allow you to share snippets of project code with the community? Would you be comfortable doing that? (not expecting you to reveal all your secrets!) Not in any way that would require you to invest time in making things plug-and-play or offering support for them - just dropping some interesting bits as Gists on Github. A possibility?
  17. 8 likes
    Couldn't you create a new "Fieldset in Tab" and place the desired fields within the tab when editing the template?
  18. 8 likes
    Posting in the hope this helps someone out of a hole! Having built 20+ sites on PW in the last couple of years (and loving it...) I came across a really odd situation recently. The client's IT company and I 've been battling for a couple of weeks and today, finally, we have an answer! The site is built and temporarily housed on a shared hosting account we have for development. All tested well here so Access was granted to the client to start adding content. The next day I get a call from the client to say the admin side of the site is logging them out every 30-40 seconds and they have to log back in again each time to continue. I tested again from our office with their login but all worked as expected. Other browsers, PCs etc. were all tried by the client but the problem persisted. So, I get in my car and drive to the client's site. Sure enough, I see the issue on one of their iMacs. So I open up my MBP, connect to their network, log in as them and the problem is there. So, next, I came off of their network and onto my tethered iPhone on 4G. Bingo! The problem goes away. So it's their network that's the issue. Their IT company were called and, with us helping them wherever possible, they worked on it for 2 weeks to find the problem. I captured the port numbers in use by PW admin (60992, 60993, 61000, 61001, 61002, 61003 by the way) and the IT company opened those ports on the router but still, the problem remained :-( And then the breakthrough... They have two VDSL lines into the building that feed their router through a load balancer. It seems that their setup meant that responses to outbound traffic did not necessarily come back in via the same line. Processwire admin does not like this! So, the IT company put in a rule to direct all traffic from the IP of the shared hosting through the same route in and out of the building and BOOM! it all works as expected. Phew! All's well that end's well but it certainly put us through the wringer tracking it down. Actually, I think it's pretty cool that PW does this. A good extra security measure. Several other CMSs (no names...) worked just fine with this scenario but not PW. Anyway, happy client, happy me. Hopefully, this story helps someone else here too.
  19. 7 likes
    This is the second site we've built for Visualization. The first launched some 5 years ago and was based on a different CMS (before we started working with PW). The site is fully responsive and features a 'quick quote system' using the FormBuilder module to manage quote requests and email both customer and site owners with the calculated quote. The prices for each part of the quote calculation are editable by the client in the CMS at any time. Every page features Meta Title and Description override option fields with tag content falling back to values based on the page's content if these are not filled in. Other than PW core v 3.0.42 additional modules are FormBuilder, ProCache and markupBlog. Any feedback welcome! http://www.avrackbuild.com/
  20. 7 likes
    Hi surffun! While I get what you're saying here, I also have to disagree with most of what you've just said First of all, to claim that "the whole productivity of ProcessWire comes only with buying pro modules" is just about as disconnected from reality as it could be. ProcessWire is extremely reliable, fast, and flexible system, and I have personally built really complex applications with it without any commercial modules at all. The productivity boost I've gained by moving on to ProcessWire has absolutely nothing to do with any of the Pro modules out there. That being said, if I need, say, a complex form builder and processor, I don't mind paying a bit for it. And I do mean a bit, considering that the developer license for FormBuilder is really not that high. In fact it's very much in line with what you'd end up paying for Gravity Forms, which is pretty much the only WordPress form builder that comes even close to our FormBuilder in terms of quality and features included. What I do have to agree, to certain extent, is that ProcessWire developers tend to steer away from things that are "already solved". I don't think that anyone is seriously considering developing a competitor to FormBuilder, for an example. This is no doubt one part about the fact that they feel they'd be stepping on someones toes by doing that, but another reason is that it'd be a lot of work. As long as the community keeps growing, I've no doubt that one day we'll have more alternatives to current Pro modules, but for the time being my opinion is that what we have now is very high quality, well maintained, and the costs are in balance. I also don't agree with your argument about them not being as well maintained or being more pricey than their WordPress counterparts, but obviously we can have differing opinions on this
  21. 7 likes
    You could not buy or use any of the Pro Modules and you would be able to make use of the great many tools within the ProcessWire core. The praise for ProcessWIre is not due to the Pro Modules. That's your opinion, which you are entitled to, however an opinion is not a fact. Drupal/Wordpress/Joomla are very large Open Source projects with many individuals and companies sponsoring their development. There's nothing wrong with how these projects fund and maintain their communities. The ProcessWire community is small, talented and growing. The developers and designers that use this product, have come from the other bigger communities. Most come here and stay because ProcessWire allows them to create and have the freedom to do things that could not easily be done in the other Open Source platforms. You can do forms without using Form Builder. It's possible and part of the ProcessWIre core. You have Repeaters and Page Tables that are part of the ProcessWIre core. Do the Pro Modules make things easier, of course they do. They are enhancements to an already solid base. There are many individuals producing free third party modules that expand the capabilities of any ProcessWire developer. You are also able to incorporate many existing Front-End Frameworks with ProcessWire with a minimum of effort. You don't need a ProcessWire version of any Open Source tool to have it work with your ProcessWire installation. The productivity of ProcessWire comes from it's ability to make creating websites or web applications not a complicated process. Unfortunately, everyone will not be able to afford the cost of some commercial modules, however that doesn't mean that they can't make outstanding websites without them. Also not based on fact. Questions are answered and solutions given to a range of difficult scenarios on a routine basis. Many participants provide custom code to solve the questions that are asked on this forum. You won't find a more better forum where people willingly give of their talents and time.
  22. 7 likes
    https://github.com/benbyford/PublishAsHidden Adds new button on edit page if page unpublished. Button saves page and sets flags to hidden and published.
  23. 7 likes
    This week we've got a great guest post from Alex Capes. Alex recently worked with design agency Human After All to build a website for Canongate, a leading independent book publisher. This post discusses the highlights, challenges and successes in building this impressive ProcessWire-powered site. I was really impressed with this site, and I think you'll like reading about it. https://processwire.com/blog/posts/building-canongate/ Next week I'm going to be out of town for much of the week so likely won't have a blog post next Friday. If anyone is interested or has ideas for another guest post, please drop me an email. Thanks.
  24. 6 likes
    Everyone, We have all given our opinions and stated why we disagree. That's should be it. This is a very friendly community of individuals who want the best tools for web creation, hence we are here. We are glad to have everyone be a part of this vibrant community. Hopefully nobody takes offense when our individual thoughts are put online or assertions are challenged. Have a great day and let's continue to work together.
  25. 6 likes
    I built this one on bootstrap 4 with a number of extras. ie. Animate on scroll for photos and carousels, navbar animate on scroll, lightbox, google map embed, and font awesome. I am using the page tree as a row builder instead of navigation. I detached the menu system from the page tree to give more control on external links, single page website situations that need to link to sections, and add new window target options. It also lets you have different footer links vs header links this way. You can add something like a privacy policy to the footer and not the header and still have one place that controls your menus. Extensions used: Color Picker, Inputfield ACE Extended, Google map marker, MarkInPageTree, Media Library, and Hana Code.
  26. 6 likes
    Maybe use url segments for the whole url and just render the pages located elsewhere based in the infos supplied by the url.
  27. 6 likes
  28. 6 likes
    I've added Robin's code to AOS (unreleased yet) with some tweaks (use placeholder search character instead ::before pseudo, on enter select first match and do not submit the form, focus on expanding the icons and position the filter next to the Show all button instead floating. I've also posted a PR to the core InputfieldIcon.
  29. 6 likes
    Hello, A friend posted a question about how obtain the markdown code for a image when you are using the markdown editor. Here I created a module just for that. You can download it here. https://github.com/NinjasCL/InputfieldImageMarkdownCodeAdditionalFields cheers.
  30. 6 likes
    +1000 to put this in core
  31. 6 likes
    Micro Contexts (aka field value contexts) Change any context-enabled setting in your page editor/template based on the value of a page reference field. Why use this? Say you have a template that is controlling some generic part of your website, like a section on the homepage, a widget, or an item in a media library. If you are using the various fields on this template in different ways depending on an option (page select) such as 'widget_type', 'media_type', etc, you can hot-switch the template context based on the field's value. Why not use template, like just change the template? Unfortunately, most of my clients would probably break down in tears if i tried to explain what a template is, or how to change it. This also allows you to have better more relevant labels, descriptions and notes based on any page ref field value on your template, as well as be able to show/hide fields based on that value, or even move fields around to make some more prominent or visible. How to use this 1.) Create a new template: 1a) Use the following name structure: mc-[field_name]-[field_value]-[any_memo_here] where [field_name] is the field that will control the micro context, and the [field_value] is the required value (page id) that the controller field must equal/have in order to trigger the virtual template context. The last part of the template name should be used for the page name, or some memo to make it easier to know from the templates list what field value will trigger the micro context, since the template name does require the ID value of the field, not the name. 1b) Make sure to specify the template you are contextualizing under "Duplicate fields used by another template" before clicking save! 1c) Edit your field settings for this template, for when your fieldname=value as specified in the template name (labels, descriptions, notes, visibility, field order etc.) 2.) Place this code in your ready.php file: wire()->addHookAfter('ProcessPageEdit::loadPage', null, function (HookEvent $e) { $page = $e->return; $mcPlates = $this->wire('templates')->find("name^=mc-"); if(!count($mcPlates)) return; foreach($mcPlates as $mcPlate) { $nameParts = explode('-', $mcPlate->name); // expected format: mc-[field_name]-[page-id]-[anything-you-want-here] $mc_field = $nameParts[1]; // the field controlling the micro context $mc_value = $nameParts[2]; // page id has to be the 3rd part of the template name $controllerField = $page->fields->get($mc_field); //if we find a matching controller field from the template name... if($controllerField) { $f_value = $page->get($controllerField->name); $proceed = false; if( ($f_value instanceof PageArray) || ($f_value instanceof Page) ) $proceed = true; // this only works with page reference fields. if(!$proceed) continue; // the page corresponding to the required value (page id) specified in the mc template name, to change micro context $mc_page = wire('pages')->get((int) $mc_value); // if the value specified in the mc template name matches the current value of the page reference field, change the // fieldgroup context $proceed = false; if( $f_value instanceof PageArray && $f_value->has($mc_page) ) $proceed = true; if( $f_value instanceof Page && $f_value == $mc_page ) $proceed = true; if($proceed) { $tName = $mcPlate->name; $mc_template = wire('templates')->find("name=$tName")->first(); if($mc_template) { $mc_fieldgroup = $mc_template->fieldgroup; $page->template->fieldgroup = $mc_fieldgroup; } } } } }); Caveats This probably needs more work to be fully usable, and may need more bullet proofing in terms of checking for valid template name, etc. You can only have this work with 1 page reference field per template. This has been tested and is being used on at least 2 live sites, but caution should be used, and the functionality should be tested before using on a live site. Screenshots: 1) a default widget with no field value context enabled fields 2.) A field value context enabled edit page for the 'Widget Type', the template controlling this is now 'mc-widget_type-1054-text', but the template of the page stays as 'widget'; only the fieldgroup context is changed when the page is loaded to get the contextual settings: 3.) the context for when the page reference field called 'widget_type' has the value of 1150, which is a video widget type (template name is 'mc-widget_type-1150-video'). Convenient Module edition coming soon!
  32. 6 likes
    Here is a little Hook that I use to add the last date of recurring events to the end of publication field. Please copy this piece of code into your ready.php file. //dates = name of your recurring field - please change it to your field name //publish_until = name of your end of publication field - please change it to your field name // hook to add the publish_until date according to the last event date $pages->addHookAfter('saveReady', function($event) { $page = $event->arguments[0]; if ($page->hasField('dates')) { $dates = $page->getDates(); if($dates){ foreach($dates as $key=>$date){ if ($key === key($dates)) $enddateunformatted = $date; } $page->publish_until = $enddateunformatted; $enddateformatted = date('d-m-Y', $date); $this->message($this->_("The end date of the publication was set to {$enddateformatted}.")); } } }); In my case I use the the SchedulePagesModule to unpublish pages after a certain date. In this case the date field for unpublishing pages is called "publish_until". My recurme field in this case is called "dates". You have to add both fields to your template. Now I want to copy the last date of the recurring events to the "publish_until" field, so that the article will be unpublished after the last recurrence. For this purpose you have to add the code above to your ready.php file. If you have named the fields differently than "publish_until" and "dates" you have to replace this by your names. In a first step I check if the template has the recurme field "dates". If yes then I check if there are events generated. The last step is to grab the last occurence and add this date to the end of the publication field ("publish_until") - finished! After pressing the save button the last ocurrence date will be saved in the publish_until field and the article will be unpublished after this date. Best regards
  33. 5 likes
    Some more nice features copy&paste (eg from excel) that way the field could be used as an import-interface with live preview (much more userfriendly than CSV in my opinion) auto-add-rows (coulb be used as something like a repeater-replacement) hot.updateSettings({ colHeaders: ['Foods'], minCols: 1, maxCols: 1, rowHeaders: false, minRows: 1, minSpareRows: 1, }); auto-add-cols (like tagging) hot.updateSettings({ colHeaders: false, minCols: 1, minSpareCols: 1, rowHeaders: ['Foods'], minRows: 1, maxRows: 1, });
  34. 5 likes
    Just working on some smaller projects and take the step into the actual master/dev version and all the new methods and api chunks that are coming with the 3.x series... since i'm not always build websites i'm not always go with the brand new things and put them in my workflow....there is a 24 per day timelimit i think...;) BUT actual i dive deep in markup regions....and holy shit this feature ROCKS! It should put in place better than in some blogposts: http://processwire.com/blog/posts/processwire-3.0.49-introduces-a-new-template-file-strategy/ http://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ or can some admins make a headline in the official docs and link to the blogentries?? This feature is to important to get missed for beginners and other users of PW! I'm just kick my whole workflow and change it for the markup regions....i'm feeling like xmas in summer Thank you @ryan Best regards and happy "new" year....
  35. 5 likes
    Hello fellow ProcessWire-ers. Here's another little project I've made: http://godesign.pt/ GOdesign is a, you've guessed it, design agency, in Portugal. I've been doing quite a few projects with them where they design, then I build. It's portuguese only, but it's just a design portfolio and little more. It was built with a modular approach that I've been applying to some projects lately. Building a project page you get a repeater, where at first you select the block type, and then the respective fields appear. That way the admin can do a block with a single image, two side by side, text on the left, text on the right, video, and so on... The approach is great, and makes me wonder how cool it would be to be able to create templates in PW that can be used in repeaters. Like creating pages, but in a repeater-like field instead of the actual tree.
  36. 5 likes
    I've been a bit like the proverbial plumber with a leaky tap, with a rather ugly site myself, but I've had a period recently with very little work, so I thought it might be time to give my own site Create IT a refresh. I've got more work to do on it, but it's enough of a step up that I'm not totally embarrassed by it now. My site was running on a CMS I've developed myself since 1999 using an obscure language Mivascript, that was actually quite popular at the time, and my first exposure to a server scripting language. To put that in context, the first version of Wordpress only came out in 2003, and to be honest my code looks quite messy in the light of modern programming best practice. I've decided I'd rather focus on adding functionality and content than maintaining an entire CMS myself, and I love Processwire for its speed and flexibility of development. I had to import my existing content which was in a mySQL database. Having written the system myself, I knew the data structure well, so the issue was how to replicate the functionality. My old CMS was started before the days of SEO and security got a great deal of attention so I had urls like index.mvc?article=6. I had to come up with a safe way to redirect these to knew Processwire URLS. The Jumplinks module came to the rescue there, as when I'd imported my data, I'd already imported the old page ids into a field in processwire, so it ended up being pretty easy to provide automatic redirects from the old URLs with just a single jumplink using a selector. The other thing I wanted to do was use Bootstrap, but customise it without creating a mess of overrides. AIOM+ came to the rescue here, with its built in ability to compile LESS files. Rather than messing around with any third party LESS compiler, I could just put the Bootstrap source directly into my project and include the LESS files directly. Processwire never fails to impress how quickly and efficiently it enables often quite complex things to be done.
  37. 5 likes
    Once they wrapped their heads around that analogy, we can proceed and explain the PageClone module using this : Kidding aside, I explain these templates to myself in terms of OOP where template = class, fields = members, and pages = objects. But biology is fine, too.
  38. 5 likes
    i keep everything for the front end in the templates folder, since a lot of modules and such use the templates directory as the assumed location of the fonts, js, css files... i tried a long time ago to keep some things outside of templates, but it didn't really help and was somewhat annoying to deal with... i can't see any reason why templates folder can't hold everything, plus then you can use alternate template folder setup for testing and development (like templates-dev)... and have a completely separate independent copy of all those things
  39. 5 likes
    AOS is at 1.4.7, containing Robin S's fixes and his IconsFilter module. I've spent much more time on the icons filter because I wanted it to be compatible with the current markup and with this PR too.
  40. 5 likes
    If I understand correctly, that a successful form submission is then redirected to /thank-you/, I would use $session. Then you could do something like this <?php // Form A if($success){ $session->formSuccess = 'formA'; } // or 'formB' etc on any other forms // then redirect to /thank-you/ and then <?php // /thank-you/ if($session->formSuccess){ switch($session->formSuccess){ case 'formA': $message = 'Thanks for submitting Form A'; break; case 'formB': // etc } $session->formSuccess = ''; } else { //redirect to /home/ or wherever }
  41. 5 likes
    @Kiwi Chris Sounds interesting! Take this small file information module as a first approach. Furthermore there is this related old and (unsupported?) module in the modules directory: http://modules.processwire.com/modules/manage-files/ Have fun with coding. <?php namespace ProcessWire; class AdminFileInfo extends WireData implements Module, ConfigurableModule { /** * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Admin File Info', 'summary' => __('Overview of all Pagefiles living under a specific branch'), 'href' => '', 'author' => 'kixe', 'version' => 100, 'icon' => 'files-o' ); } /** * Initialize, attach hooks * */ public function init() { } /** * create Info Table * */ static public function getInfoTable($parentID = 1) { $treePages = wire('pages')->find("has_parent=$parentID,include=all"); $table = wire('modules')->get('MarkupAdminDataTable'); $table->headerRow(array('PageID','Filename','size')); $table->totalSize = 0; // byte counter // @todo Notice: Undefined offset: 1 in /Users/c/Sites/_processwire/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module on line 276 foreach ($treePages as $singlePage) { if (PagefilesManager::hasFiles($singlePage) == false) continue; // no files $pageFileNames = $singlePage->filesManager->getFiles(); // get all files of this page foreach ($pageFileNames as $pageFileName) { if(null === $file = $singlePage->filesManager->getFile($pageFileName)) continue; // orphaned stuff $table->totalSize += $file->filesize; $table->row(array("#$singlePage->id" => $singlePage->editUrl, $pageFileName => $file->url, wireBytesStr($file->filesize))); } } return $table; } /** * module settings * */ static public function getModuleConfigInputfields(array $data) { $modules = wire('modules'); $parentID = isset($data['parent'])? $data['parent']: null; $fields = new InputfieldWrapper(); $f = $modules->get('InputfieldPageListSelect'); $f->attr('id+name', 'parent'); $f->attr('value', $parentID); $f->icon = 'tree'; $f->label = __('Page Tree Parent'); $f->description = __("Select a parent page and click submit to get information about all files under this tree."); $fields->add($f); if ($parentID) { $page = wire('pages')->get($parentID); $table = self::getInfoTable($parentID); $f = $modules->get('InputfieldMarkup'); $f->label = __('File Info for Page Branch: ').$page->path; $_description = __("This page branch uses %s of storage space for files."); $f->description = sprintf($_description, wireBytesStr($table->totalSize)); $f->value = $table->render(); $fields->add($f); } return $fields; } }
  42. 5 likes
    I have not seen an htaccess file with a version number on it. The install procedure should have renamed the htaccess.txt to .htaccess if your permissions were set correctly. Is your document root defined as reidsengland ? Or is the document root reid ? If the docroot is reid, and you placed the PW files in the reidsengland sub folder, then the rewritebase should be /reidsengland/. You have probably already seen this, but I'm posting it for others too. Troubleshooting
  43. 4 likes
    Hi @surffun I think that it is not correct to compare Processwire with Joomla or Wordpress because in their blank installation you can't find all these features, flexibility and power that you can find in PW. To make Joomla as flexible as PW you have to use some CCK as Seblod or Cobalt, but they also have limited functionality which can be expanded by premium plugins. So with PW, for free you get a lot of features which are available only in premium plugins in other CMS. I think that the right CMS to compare with PW is Craft CMS. Yes, it is free for personal sites but with a lot of restrictions which you don't have for free in PW. Let's take "Client" version of it, the price is $199 per site or "Pro" with $299 per site. So Craft Pro $299 (per site) = Processwire + ProFields $129 ( unlimited use ).
  44. 4 likes
    @Macrura, your Micro Contexts idea is clever. The approach you are taking here (effectively a single template where fields may be shown/hidden and labels/descriptions changed depending on context) is in fact exactly what is done in Repeater Matrix. Every matrix item (page) actually has the same fields, but the field visibility and labels etc are controlled by the matrix type context. So that got me thinking that all that is needed to do something similar with Repeater Matrix is to add some control that allows the user to change the matrix type of an existing Repeater Matrix item. The advantages over the Micro Contexts approach are: You don't have multiple templates that must be kept in sync if new fields are added - if you add a new field to any given matrix type it is added to the single Repeater Matrix field template. You can do all your field overrides (visibility, width, label, description, notes) from a single screen (the Repeater Matrix field settings). So as a result it's quicker to set up and easier to maintain. I have put in a request to Ryan to add such a control, but I had a play around and managed to get something working with a couple of hooks. To use this... Create a new text field named 'block_type' (best to create a dedicated field for the purpose). Set the field visibility to 'Closed' (to keep it discreet). In your Repeater Matrix field settings, add the block_type field as the first field in each matrix type. Add the hooks below to /site/ready.php... // Change the block_type inputfield to a matrix type select $wire->addHookAfter('InputfieldText::render', function(HookEvent $event) { $inputfield = $event->object; $field = $inputfield->hasField; if(!$field || $field->name !== 'block_type') return; if($inputfield->name === 'block_type') return; // in case field is not being rendered inside repeater inputfield $rpage_id = str_replace('block_type_repeater', '', $inputfield->name); $rpage = $this->pages->get($rpage_id); if(!$rpage->id) return; // just in case $matrix_field_name = substr($rpage->template->name, 9); $matrix_field = $this->fields->get($matrix_field_name); $raw_matrix_types = $matrix_field->type->getMatrixTypes($matrix_field); $matrix_types = []; foreach($raw_matrix_types as $key => $value) { $label = $matrix_field->get("matrix{$value}_label"); $matrix_types[$value] = $label ?: $key; } $if = $this->modules->get('InputfieldSelect'); $if->name = $inputfield->name; $if->label = $inputfield->label; $if->required = true; foreach($matrix_types as $key => $value) { $if->addOption($key, $value); } $if->value = $rpage->repeater_matrix_type; $event->return = $if->render(); }); // Change the matrix type on saveReady $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if(!$page instanceof RepeaterMatrixPage || $page->block_type === null) return; if($page->isChanged('block_type')) $page->setMatrixType($page->block_type); }); If you wanted to remove certain Repeater Matrix inputfield controls then you would use a hook/module as discussed in earlier posts in this thread.
  45. 4 likes
    Adding to @Macrura's suggestion: rather than do the preg_replace and str_replace to remove the unwanted doctype, body, etc, you can avoid those by using an options parameter for loadHTML(): $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
  46. 4 likes
    Hello MrSnoozles, in Processwire template files are not actually templates and You can actually use them as controllers (see the "delayed approach" in pw tutorials). In template files You can manage the request ($input), build forms (InputfieldForm module instances) and assign variables which are later used in the included view file(s). (btw, I use the ".phtml" extension for my views/partials to distinguish them from template/controller files ".php"). If you ever worked with Silverstripe you can actually think of template files code as Silverstripe's Page_Controller classes ' method code. You can leverage pw's urlSegment feature to add sub-routes for the current page/template. If you have a contact-page template (/contact-us/) You can use a "submit" segment ($input->urlSegment(1)) and use "/contact-us/submit" as the form action, the same way You can add any route segment in a Silverstripe (Page_)Controller class. I don't find it useful to add code used only by the "contact-page" template in a global function inside (_func.php). As in Silverstripe cmf the segment approach has the advantage that it continues to work even if you change the url (name) of the page using that template. Think of template files as controllers: while in other frameworks you have to assign controllers to routes, in PW a route (Page path/url) is automatically linked to a peculiar controller (template) by the fact that the Page with that route is using that template. kind regards, maks feltrin
  47. 4 likes
    hello @gebeer it is possible to add as much dates as you want to one day (fe. 100 or more if you want). You only have to create one event (page) for each of your events and make them recurring to your needs. So from the module there are no restrictions. It also doesnt matter if the starting and ending time of several events are the same on the same day. On the calendar view only few events are displayed for this day (depending on the space in the calendar row - see next image on the 6th). All others will be overflown. After hovering the calendar cell all events on that day will be displayed. If you are entering fe 100 events on that day (and I am sure you would probably not ) the list will be very long, but technically it would be possible. There are a lot of recurrence possiblilities fe. the first and the last day of a month every second monday every month,.... take look at the documentation. Jürgen
  48. 4 likes
    For that kind of system I'd probably go with laravel spark.
  49. 4 likes
    In general I'd say build classes as independent as possible from processwire and to integrate it in PW just add a module as wrapper around your class, which does tie any processwire specifics (hook / module config / process interface / …) into what your class does on it's own.
  50. 4 likes
    It seems like chapter sites are to be rather independent, though alike. So you probably would like to have them each in separate installation (with different databases). [Relatively simple stuff] To speed up the creation of a new chapter site you can develop a site profile and start each new one with it rather than from one of the default ones. But this way you will still have each site with non-connnected-to-other-sites files and will have to handle the updates to the site files separately. [More advanced further...] You can run the sites from the common core though (see here, option 1), so you will have to update the core only once for all of the chapter sites. [Try at your own risk] If the chapter site will have really the same template structure and will differ only with the database-stores content you could symlink all site/templates and probably site/modules folders to one common place. But you will still have to manage changes made in admin area one by one... [That is only for the record. Never done it myself] Or use something like this or this.