Leaderboard
Popular Content
Showing content with the highest reputation on 06/24/2016 in all areas
-
This week we have a few nice tweaks for those using multi-language support and translation tools in ProcessWire. Plus improvements to the 2.8.x branch, and a new feature for repeaters. https://processwire.com/blog/posts/pw-3.0.23/11 points
-
See the screenshots below for a demo of how the Inputfield Selectize module can be used with getForPage()... Page with repeater field Page field using Inputfield Selectize Page field options (note: I'm recycling an existing 'headline' field as the attribute in the repeater) Edit: I'm a big fan of the new Inputfield Selectize, but if you want to use one of the other Page inputfields then have a read of this post - you'll see how the code could be adapted to use getForPage().3 points
-
Hi folks So I actually just added this as a pull request on Github before figuring out it's already possible in the system. What I wanted was an ASMSelect field (can be a normal select or other Page field) where the list was ordered in a certain way and pulled from two sets of pages with different templates. The trick was that I wanted the labels for one set of pages to include the parent page name in the label so they're sorted by parent title, then title, but the other set of pages was just to be added to the end in alphabetical order. I've anonymised the example somewhat, but I have a medical blog where I wanted to categorise posts against medical procedures listed on the site, as well as other blog-specific, general categories. To achieve what I wanted, I selected ASMSelect as the Page Inputfield type, then used the "Custom PHP code to find selectable pages" option and did this: $options = new PageArray(); foreach ($pages->find("template=surgery, sort=parent.name, sort=name") as $category) { $category->title = $category->parent->title . ' / ' . $category->title; $options->add($category); } $options->add($pages->find("template=blog-category, sort=name")); return $options; This results in a nice, alphabetised list such as: Surgery Category A / Procedure 1 Surgery Category A / Procedure 2 Surgery Category A / Procedure 3 Surgery Category B / Procedure 4 Surgery Category C / Procedure 5 Surgery Category C / Procedure 6 General Category A General Category B General Category C and so on, so the surgery pages are in the format {parent.title} / {title} in the Select list, and the blog-category pages are just the normal {title}, all ordered alphabetically by parent (where necessary) and page title. Nice and easy2 points
-
it wouldn't work with Selectize.js because the fields select there is a special ASM select with nestable ability for the fieldsets. I think the only way would be enable the field itself to have an option of autocomplete. The ideal way would be not to have automcomplete, but instead to have a search filter, because i think most of the time you do want to see all the options, but still be able to find what you want by typing.2 points
-
I think your question relates more to how PW sorts PageArrays created via find() rather than Hanna Code specifically. I guess you are doing something like this in your PHP: $my_pages = $pages->find("id=1086|1021|1053|1018"); I was surprised to discover, as you did, that the resulting PageArray does not sort the pages in the order the IDs were given. This is what I came up with as a workaround: $my_ids = [1086,1021,1053,1018]; $my_pages = new PageArray(); foreach($my_ids as $id) { $my_pages->push($pages($id)); } I'd be keen to hear if there is a better way to get pages into a PageArray while maintaining a given order of page IDs.2 points
-
2 points
-
This module extends WireMail base class, integrating the PHPMailer mailing library into ProcessWire. Module Directory - Githup repo1 point
-
This module helps you dynamically create schemas for improved SEO & SERP listings from within your templates. Each schema can be configured to meet your requirements. You can even add your own ProcessWire schema classes to the module. Read about the module on github: https://github.com/clipmagic/MarkupJsonLDSchema Download from github: https://github.com/clipmagic/MarkupJsonLDSchema/zipball/master Download from ProcessWire modules: http://modules.processwire.com/modules/markup-json-ldschema/1 point
-
cool that you found the selectize inputfield.. hope it works well and let me know if you run into any issues or requests. In combination with the custom PHP option it opens up to almost anything.. hope to be releasing an ajax version sometime in future..1 point
-
1 point
-
Very nice updates! I wish you worked more on mutilanguage sites to get such great improvements1 point
-
Thanks Wanze - very good point! When I wrote that module I initially had things set up quite differently such that it required rendering the template file directly. More recent changes mean that it no longer needs to do that. Rendering the page directly (like you noted) works fine here, so I will make that change to the module anyway and hopefully it will solve the problem with TEF. PS New version with this change just committed.1 point
-
Hi both, I don't know the module myself and I'm not sure why your prepended file is not respected when rendering via a filename. Can you try if this works? This should trigger the Page::render() of the search page and also output the markup from your corresponding smarty template. $event->return = $this->pages->get($this->searchPage)->render();1 point
-
No. 1 is a violation of the WireMail interface, which says send() should return an integer and not a boolean. This should rather be changed in the module than in user-code.1 point
-
I'm working on converting a site from WireMailSMTP + Mandrill to using Mailgun. In case anyone else needs to do this i'm posting the steps and snafus here. So far in adapting the existing code, the differences i have logged so far are; 1.) in WireMailSMTP you have to set sendSingle(true) if you want the messages to each be sent individually, but this is the default for WireMailMailgun, so that call gets removed. 2.) the method for adding attachments differs: this: $mail->attachment(string $filepath); becomes this: $mail->addAttachment(string $filepath); 3.) If your site sends from different domains, then you need to switch that setting before send. It appears to me that the API key is the same for all my domains, so I should only need to change the one setting when i send the email assuming i have already entered the API key in the WireMailMailgun module settings, then i can extract the domain of sending email address and set the domain to that (and also assuming I have all of those domains configured in Mailgun). $domain = substr(strrchr($identity->email, "@"), 1); $mail->setDomainName($domain); *** This doesn't actually work because the runtime setting is not overriding the domain that is set in the ___send() options. *** I made modifications to the module and now i have this working with my system; would probably need another setting like "match "sending domain" to "from email" domain" or something and also make the domain field optional in the module settings.. https://github.com/plauclair/WireMailMailgun/issues/7 ------------------------------------------------------------------------------------------------------------ Additional comments and observations: - would also be nice if an attachment() method could simply be added which aliases the other method (would save some code checks)1 point
-
The thing is, that people have different ways of working. I prefer to use just plain old CSS from the start and do not feel its worth messing around with Less/scss or similar thing. Thats were my way of using this PHP script come into play. But as i said, thats the beauty with the our age of web development that you can choose the way that works best for you. And you can run all sorts of string functions on the main css file when its been merged to lets say minizise and such. I know you can do that with your workflow as well. But i also see this as an oportunity to use PHP do to different things. Besides i like to experiment.1 point
-
Ha, checked those links on Archive.org - they were old links from when we used SMF forums back in 2012 and earlier. It's entirely possible they've been broken the whole time... I'll have a look and see if there are any others in need of an update. EDIT: so it wasn't this forum upgrade that broke them is what I'm getting at - they've been broken for a long time1 point
-
The latest version now contains three different versions of the Tracy core! Yes, it's a pain and I don't want to maintain them either, and hopefully I can ditch one of these versions shortly if PW's SessionHandlerDB module can be tweaked to work with Tracy - more details below. Stable (now the old 2.3 branch) supports PHP 5.3 and because PW supports 5.3, I'll keep this version included until PW shifts to 5.4. doesn't capture AJAX requests works with the PW core SessionHandlerDB module Master (this version is actually a version from a couple of months ago now) needs PHP 5.4 doesn't capture AJAX requests works with the PW core SessionHandlerDB module Latest (this is the current dev version, currently 2.4 - I'll keep this fairly up to date) needs PHP 5.4 captures AJAX requests it does NOT currently work properly with the PW core SessionHandlerDB module - there are db table field length restrictions, issues with the MYSQL max_allowed_packet setting, and it prevents the capturing of AJAX requests if it's installed. The errors can be fixed by tweaking your sql settings, but you still can't get AJAX requests working. Yes, the names of these versions are no longer correct. I will be changing these soon, but didn't want to do too much on this at once. I personally have decided to give up on SessionHandlerDB until it can be tweaked so that it doesn't break the latest version of Tracy. I find the features in the latest Tracy core worth it, but it's up to you guys what you want to do. I'd be curious to hear which version you decide to use. Let me know if you have any questions.1 point
-
New version just committed that takes care of most of the problems/suggestions that @bernhard noted above. The console code is now also saved to LocalStorage as you type. I am also hoping that the conflict issue that @Macrura brought up is also fixed. Please let me know! PS - the issue with the garbled code in the "open in window" mode was very painful to fix, but at least I learned a lot more about the inner workings of ACE and the Tracy core from reading through the source code. I discovered a nice shortcut for when you want the "open in window" mode - simply SHIFT+CLICK on an icon in the debug bar to avoid going through the FLOAT mode first.1 point
-
Updated the module to version 1.1.0 which adds the following features: Multiple data can be passed to the template engine via setArray() (alias: setMultiple()) The module now provides a second API variable $factory returning the singleton instance of the TemplateEngineFactory, which can be used to load partial views and chunks Chunks: Reusable code snippets that consist of a PHP file containing the logic and a template (view) to render the output (see https://github.com/wanze/TemplateEngineFactory#chunks) Thanks @justb3a for the contributions! Twig and Smarty modules were updated as well, shipping with the newest version of Twig/Smarty. I tested the module on the latest ProcessWire 2.7 and 3.x and everything worked fine. Let me know if you find any issues! Cheers1 point
-
Repeaters are located in /admin so access protected too. So I guess for a not logged in user you wouldn't be able to $pages->find(selector) the repeater pages. I think then you'd need a "check_access=0" or a "include=all". Since they're in /admin you could also consider implicit "has_parent=RepeaterParentID" or "has_parent=2" ($config->adminRootPageID) instead of exluding trash somehow.1 point
-
I believe he meant what he has said: " Keep in mind that include=all will include a lot more than just unpublished pages." If it currently is working for you with include=all instead of include=hidden as suggested by @LostKobrakai, you only need to wait until the first page in your trash will match the selector too.1 point
-
include=hidden, status!=unpublished, Keep in mind that include=all will include a lot more than just unpublished pages.1 point
-
Some posts earlier i wrote i will give an detailed example of how you could use the Formhelper Module from pwFoo to create a register form an build the logic yourself if you need more complex setups. This is a stripped example from my register.php (please ignore the spelling while i've translated the most parts just quick and dirty for this post...) Best Regards mr-fan1 point
-
My personal opinion is: this is uggly code, hard to read, hard to maintain. I would do it more like this: switch($switchColor) { case "Style3": $cssLink = AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style3.css')); break; case "Style4": $cssLink = AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/style4.css')); break; default: $cssLink = AIOM::CSS(array('styles/style1.css', 'styles/slider.css', 'styles/style2.css', 'styles/normal.css')); } echo "<link rel='stylesheet' href='{$cssLink}' />"; To be honest, it could be made a bit more readable: $myStyles = array('styles/style1.css', 'styles/slider.css', 'styles/style2.css'); if('Style3' == $switchColor) { $myStyles[] = 'styles/style3.css'; } else if('Style4' == $switchColor) { $myStyles[] = 'styles/style4.css'; } else { $myStyles[] = 'styles/normal.css'; } $cssLink = AIOM::CSS($myStyles); echo "<link rel='stylesheet' href='{$cssLink}' />"; // ---------------------------------------------------- // or just ? echo "<link rel='stylesheet' href='" . AIOM::CSS($myStyles) . "' />"; // or ? echo '<link rel="stylesheet" href="' . AIOM::CSS($myStyles) . '" />';1 point
-
$pages->addHook('saved', function(){ $pages = $event->object; $page = $event->arguments(0); if($page->template != 'single-comment') return; $total = array_sum($pages->find("template=single_comment, indice_01!=''")->explode('indice_01')); $pages->get('/comments/')->setAndSave('totale_indice_01', $total); }); Just keep in mind that this won't scale well. It's loading all those pages at once with this. If you need a more scaleable alternative take a look at the new findMany in 2.8/3.0 or maybe even raw mysql counts/sums.1 point
-
Think you're adding a hook not listening for one. $pages->addHookAfter or the before are listeners. Before or after shouldn't matter as they are both before the save.1 point
-
I'm not sure how you want the result to look like, but this is adding the number to the total each time you're saving a page, meaning I'll just get more and more on each save. If you really want to have a sum of those field's you'd need load all instances each time and sum them up to get a (probably more useful) value. Also here's a $ to much after the ->.1 point
-
Interesting. I found this a few days ago: https://sandstorm.io/ https://sandstorm.io/apps/:1 point
-
You can also use "subfields" like template.name, template.id ... maybe not a good example but you get the idea, most or all that can be also used in selectors like created_users_id etc.1 point