Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/29/2017 in all areas

  1. 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!
    6 points
  2. 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.
    2 points
  3. @Robin S, please can you test an update from an installed version prior to 1.1.0? I have updated the github repo to 1.1.7. The first "update" has to be done by installing via ClassName in side -> modules -> new: Module Class Name = CroppableImage3 It has worked for me this way. Existing directory was changed / updated with all new files, old unused files were removed. And now, after that, it is recognized by the updater module! Yeah!
    2 points
  4. 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
    1 point
  5. Welcome to the forums, @future_vision! Please provide more details to get a (hopefully) good answer (an advice applicable to any question. I know)) Should the chapter sites have their own domains/subdomains or they will be all on one? Do you need to manage access control to chapter sites or they will be managed by a single person/group of people? How different/similar would the chapter sites be? Maybe even paste the chapter and the main site structure outlines. The question seems too general, I suggest we narrow it down a bit.
    1 point
  6. @MaryMatlow what version of PHP are you using? You do need to be on 5.4+
    1 point
  7. can you provide screenshots of your templates folder, and the screen showing where you entered the alternate template file name. other considerations, are you using delayed output, do you have _main.php... also pls. post the debug message, url etc..
    1 point
  8. This is very likely the reason! I've gone through this types of errors a lot! Images with AdobeRGB or sth alike.
    1 point
  9. Yes, it was just a test of a first install. But just now I forked the module and added the new CroppableImage3.module to the module root (nothing else). With the current CI3 version already installed I installed the modified module via "Add Module From URL": https://github.com/Toutouwai/CroppableImage3/archive/master.zip This seemed to work without a hitch. Installing via the Upgrades module is perhaps a little different, but I have no way to test that.
    1 point
  10. This is strange. You wouldnt expect problems with bluehost at first thought. Looks like a decent hosting company. I am on the road right now otherwise you could pm me your cpanel and ftp access so I could check what is going on there. Maybe one of the others have time now ? If not by then I am back home at 15:00 GMT
    1 point
  11. Taking the current version of CI3 and adding this 'CroppableImage3.module' file in the module root enabled all the dependent modules to be installed/uninstalled in one go without any major problem for me: <?php namespace ProcessWire; class CroppableImage3 extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Croppable Image 3', 'summary' => 'One or more image uploads (optional predefined crops)', 'author' => 'Horst Nogajski', 'version' => '1.1.5', 'requires' => 'ProcessWire>=3.0.20, PHP>=5.3.8', 'installs' => 'FieldtypeCroppableImage3, InputfieldCroppableImage3, ProcessCroppableImage3', 'icon' => 'crop' ); } public function ___uninstall() { // Remove related modules on uninstall - not essential $this->modules->uninstall('FieldtypeCroppableImage3'); $this->modules->uninstall('InputfieldCroppableImage3'); $this->modules->uninstall('ProcessCroppableImage3'); } } Tracy picks up a few minor PHP notices coming from ProcessCroppableImage3 during install/uninstall but should be simple enough to iron those out. Lines 344 & 349 on install, lines 48 & 49 on uninstall - I think these notices occur with the current version too. If you went this way you could consider moving FieldtypeCroppableImage3.module back into a subfolder just to keep things tidy. Also, after adding this file the Upgrades module detects CroppableImage3.
    1 point
  12. @Robin S thanks for letting us know. I will experiment And see if I can reproduce this behavior. Glad it's working correctly
    1 point
  13. Maybe a color management / color profile issue? http://www.color-management-guide.com/web-browser-color-management.html I think it is still best to stick to sRGB. I do not think that with mainstream monitors we will ever be able to expect that people out there will see the "same" colors as we do on our own screen.
    1 point
  14. 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
    1 point
  15. That's it. Personally, after using Drupal, then Wordpress, I find it very liberating not having to set up predefined 'regions' or any of that stuff. I create the fields, populate them, then they go where I want them to go by simply sticking them in a template, job done. Craft CMS is very similar to this approach but has a price tag with it per site that led me to PW. Glad I did though, try it out, you might like it. Absolutely
    1 point
  16. @ryan, I want to let you know I really admire the way you get things done! Every time you solve a problem it is an example of a perfect engineer solution. Spot a chance to create a feature everybody wants but few have, examine existing solutions present, learn from them, build on them, make them work better than before, deliver a working feature within a reasonable time frame, provide comprehensive docs right there in the code for tech people, write a press release for the end users, move on to another task. Way back I once started a topic called "What is "Reiska". I think now I can feel what @apeisa and others at Avoine meant by this title. There is such a word in every language, and all of them fit you and your type of people (of which there is quite a few here in forums, luckily). I sometimes find myself questioning some of your marketing and organizational decisions, but I always applaud to and try to learn those problem solving skills and mindset from you. ProcessWire is unique thing, that inspired my way from "anykey clicking" web development to managing to read and write some relatively complicated code. I try hard to provide my clients with the best engineer solutions they can get based on ProcessWire. Because I can, and because it so exiting to do with PW, and because this is the way real stuff should be done. Thanks for the inspiration.
    1 point
  17. This job has been filled guys. Thanks for all the replies.
    1 point
  18. I'm sure there is a ProcessWire way to do it, but I'm not skilled enough yet, so I settled for a document tree that looks like this: /home/policy/tos /home/policy/privacy /home/policy/aup ... which presents urls like, domain.com/policy/tos, etc. Those pages use the 'policy' template so that I can select or exclude them depending on which menu I'm rendering.
    1 point
  19. Hi Robin, Thanks for your kind words. To answer your question, no there is no "edit this occurance" button... although we have gone back and forth on that one for a while. However, you can still get the desired effect by duplicating your event for just that special instance and removing the occurance from the original. You basically are just doing the job of the "edit this occurance" button manually. The next release of Recurme will include selecting multiple additional dates to add to a recurrence. That will also solve your needs nicely. Hope that makes sense. Happy coding.
    1 point
  20. I just finished a medium sized website/SPA using processwire and vue with vue router and vuex. Has lots of nice features like server side rendering, happy to share details with people if they'd be interested. Shoot me a PM.
    1 point
  21. Hi everybody. I found only one site in showcase section which uses Padloper. https://www.the-weekender.com/ Are there some other known examples of using Padloper?
    1 point
  22. I don't know for sure what Reiska means either, but @apeisa told me that was apparently my Finnish name and that it means something along the lines of handyman. I had a member-title spot open, so I put it there. But if it's translating anywhere as "god of all heavens" or something like that, then I need to change it. I'm okay with being a handyman or somebody that fixes things, but need to change it reads as something egotistical.
    1 point
×
×
  • Create New...