-
Posts
5,039 -
Joined
-
Days Won
340
Everything posted by Robin S
-
Search to find pages containing ALL search terms across different fields
Robin S replied to JoshoB's topic in General Support
No, it doesn't search as a phrase but it does require all of the words to be present in the field, and does not match partial words. So if $q = "red dog" it will match "I have a dog and she loves red frisbees" but it won't match "I have three red dogs". When using the %= operator with multiple words, you will need to explode on spaces and foreach: $q = preg_replace("/\s+/", ' ', trim($q)); // trim and replace multiple spaces with single space $q_words = explode(' ', $q); $selector = "template=product, limit=10"; foreach($q_words as $q_word) { $selector .= ", title|subtitle|summary|body|product_isbn|authors.authors_name%=$q_word"; } -
Search to find pages containing ALL search terms across different fields
Robin S replied to JoshoB's topic in General Support
@JoshoB, the problem is in the first line: $q = str_replace(' ', '|', $q); You are replacing the space character with the selector "or" operator, meaning wherever you use $q you will match fields with any of the words. So you want to remove that line. By the way, your way of matching the author title in the repeater is unnecessarily verbose. You can replace... authors=[authors_name=[title%=$q]] ...with... authors.authors_name%=$q ...because in a selector PW will try to match a string to a Page Reference's title by default. This selector should do what you want: $selector = "template=product, limit=10, title|subtitle|summary|body|product_isbn|authors.authors_name~=$q)"; -
Cool stuff! The profiles you mention: are they a different format from the profiles produced by ProcessExportProfile? Just wondering because you said... ...but site profiles from ProcessExportProfile can include modules, so wasn't sure.
-
@Ivan Gretsky, if you have Imagick installed you could use this function I wrote a while back for easy ImageMagick effects: It does quite a nice blur. But now that supporting IE is less of an issue you could also try a CSS filter.
-
Images won't save if field is within a Fieldset in Tab
Robin S replied to FireWire's topic in General Support
When debugging something like this (for a possible bug report) it's best to do it on a new PW installation on your localhost - you don't want to be messing with your actual project installation. It only takes a few minutes to do a fresh install for testing purposes. -
Images won't save if field is within a Fieldset in Tab
Robin S replied to FireWire's topic in General Support
Still works for me... You're testing this with no other non-default modules installed apart from FieldsetPage? -
Images won't save if field is within a Fieldset in Tab
Robin S replied to FireWire's topic in General Support
No problems here uploading images inside a FieldsetPage, whether the FieldsetPage is inside a FieldsetTab or not. -
@webhoes, I haven't used the Multisite module, but the readme you should have defined separate 404 pages for each domain. So this kind of setup is probably not compatible with Process404Search out-of-the-box. But based on this section of the readme... ...you should be able to get the correct links by modifying the search.php adrian refers to above: foreach($viewableMatches as $m) { $url = "{$input->scheme}://{$m->rootParent->name}/{$m->url}"; $content .= "<p><a href='$url'>$m->title</a></p>"; } Not tested. Also note that your page tree... ...is what the Multisite readme says not to do:
-
-
This sounds interesting but I'm not quite getting it. Could you give some examples of what kinds of scenarios this would be useful in? I thought the PagePathHistory module took care of everything automatically so you never need to think about manually creating or editing redirects. Or does this module allow you to also create redirects when there never was a page at a particular URL? e.g. /some-path-where-there-never-was-a-page/ => /some-page-that-exists/
-
Images won't save if field is within a Fieldset in Tab
Robin S replied to FireWire's topic in General Support
Based on that thumbnail URL I'd be looking closely at ProDrafts. You could try a clean installation with only ProDrafts added and see if the fieldset issue is reproducible. -
I think I have things set up the same as you and it's working... Repeater fields (title visibility is set to "hidden"): Hook: $wire->addHookAfter('Pages::saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'repeater_test_repeater') { $title = 'No pages selected'; if($page->test_page->count) $title = $page->test_page->implode(', ', 'title'); $page->title = $title; } }); Result: Tracy Debugger will be helpful in debugging what is going inside your hook.
-
Looking around, it seems that getting/saving/loading the table metadata like merged cells and comments is not well supported/documented in Handsontable. And I think the merge cells plugin is undergoing an overhaul currently. There are a few hacky examples out there and when I get around to it I'll see what I can come up with and report back. But for my current project I have decided to go with a different solution for tables (tables in CKEditor plus some jQuery manipulation is proving adequate... barely ).
-
Weird Error when Trying to Edit a Users Password
Robin S replied to quickjeff's topic in API & Templates
This is an issue with the Process Batcher module so you might want to raise it with the module author over in the support thread. If you're using Batcher in PW3 you'll need my PW3-compatible fork until the pull request is merged. -
Filter out past events when using pageReference field (front end)
Robin S replied to a-ok's topic in General Support
A bit more about this... -
The first hook in your post works as expected for me - it sets the title field inside the repeater item (assuming there is a title field included in your repeater). But the last hook in your post looks like maybe you are instead trying to do something different - like you have a one "variations" repeater nested inside another "variations" repeater and you are concatenating the titles of the nested repeater to the parent repeater title. Incidentally, you should add a template check in that hook or you will get a PHP error for invalid foreach argument on any page that doesn't include the variations field. Can you explain some more about what the objective is?
-
You'd think so, but test it and I think you'll find that assets added in renderReady() are always loaded when the inputfield may appear in Page Edit, even if AJAX-loaded. So for example, you can put an inputfield with a JS dependency such as PageAutocomplete in a repeater, and put that repeater inside another repeater (so the PageAutocomplete inputfield is definitely not being rendered initially) and you'll find that the PageAutocomplete JS dependency is included in Page Edit. PW seems to be smart like that.
-
I believe this is what Inputfield::renderReady() is for: adding dependencies to $config->scripts and $config->styles, and also adding JS objects to ProcessWire.config via $config->js(). But I think all this is not well understood by module developers, myself included. Would be great to get a tutorial some time, maybe in a weekly blog post @ryan?
-
Hi @bernhard, Do you think it would be possible to support merged cells in FieldtypeHandsontable? Merging cells is a feature in Handonstable, but the merged status (i.e. colspan/rowspan) is lost when the field is saved and reloaded. I guess there would also need to be some way of determining if a cell is merged when getting it via the API.
-
Is there a way to add a filter based on template flags in Lister (or Lister Pro)? I want to exclude pages that use a system template because I don't want to see repeater pages and I'd rather not have to come back and exclude specific repeater templates as new fields are added. Seems like this should be possible but I can't see a filter option for it. Also, I thought it was possible to type in a custom filter to Lister. Or is that only supported in the standalone InputfieldSelector? Edit: okay, I could just exclude the "Repeaters" or better yet "Admin" parent page in has_parent, but the question stands: it it not possible to filter by properties of a template?
-
- 1
-
-
This might be because the "complexify factor" is something internal to the JS library used in InputfieldPassword - perhaps difficult or too time-consuming to port to PHP. I'm putting together a little module that adds a "Generate password" button to InputfieldPassword and from my testing it seems you can probably ignore the complexify setting in your EmailNewUser module because when set to the advised range of 0.5 - 1.0 then any randomly generated password seems to satisfy the complexify setting. Incidentally, I'm not a fan of vague settings like "complexify" because it's totally meaningless to the user who is setting the password. Imagine getting feedback like "Sorry, your password is 0.1 units not complexified enough." The inputfield currently says "too common" when failing the complexify setting but that's not really accurate because a random string can fail a high complexify setting. Settings like this can make for infuriating UX. I noticed that and found it very strange. It must be deliberate because the method comment says: But surely if you are setting a max length you want a max length for the whole password? Can't think why Ryan would have designed it that way. I have put in a feature request on GitHub.
-
You're absolutely right - I thought the links were opened with Javascript and that therefore I couldn't control the target tab, but I was getting them mixed up with the parent class link which just toggles the list of class methods open and closed. So all good, thanks.
-
@fbg13, thanks, that might have been what I was remembering. I found a better method in the same class: randomPass(). It gives you a lot more control over the generated password and avoids similar characters like I/1 and O/0. I still think it would be handy to have something that can pull settings from a given FieldtypePassword field though. And a "Generate password" button in the inputfield would be cool too.
-
@tpr, just following up a request from a while back. I think this is similar to the issue @szabesz raised the other day - it affects both the core Lister and Lister Pro. I'd like to keep the Lister tweaks active in AOS because the "Show action buttons on hover" is handy but I'd like to have a way to turn off the fixed selection of columns. I think if the columns AsmSelect is empty for a Lister then AOS should take that as meaning "do nothing to this Lister's columns".
-
Is there some API method to generate a random password that satisfies the settings of a given FieldtypePassword field? Something like: // Pseudocode $f = $fields->get('pass'); $random_pass = $f->generatePass(); I feel like I've seen something like this somewhere but maybe that's just wishful thinking. At the moment I'm doing this for random passwords (picked up somewhere in the forums here)... // Generate a random, temporary password $pass = ''; $chars = 'abcdefghjkmnopqrstuvwxyz23456789!@#$%&*'; $length = mt_rand(9,12); // password between 9 and 12 characters for($n = 0; $n < $length; $n++) $pass .= $chars[mt_rand(0, strlen($chars)-1)]; ...but is there a better way that takes into account the settings of a password field?