Jump to content

Robin S

Members
  • Posts

    5,008
  • Joined

  • Days Won

    333

Everything posted by Robin S

  1. This tells you that there are no published, non-hidden pages using template "staff-page" under parent with id "1018" with a field named "locations" containing the current page. Try removing parts of the selector to find out what part of it causes no pages to match the selector. If you are wanting to match hidden or unpublished pages see the docs here: https://processwire.com/api/selectors/#access_control
  2. In PHP you have to use double quotes if you want variables (i.e. $page) to be parsed inside a quoted string. See: http://php.net/manual/en/language.types.string.php#language.types.string.parsing $doctors = $pages->find("template=staff-page,parent=1018,locations=$page");
  3. @tpr, this is a minor thing, but I'm wondering if the magnifying glass icon could be changed perhaps. One thing is that its direction changes in different usages: Another thing (and this is a personal opinion) is that this coloured icon is kinda ugly. It's style is too different to other icons in the UI and it stands out too much. I see that the icon is rendered using Segoe UI Emoji, so maybe the coloured appearance is just a Windows thing? Maybe you could use the Font Awesome version that is bundled with PW (although the magnifying glass icon there is also pretty naff). Or maybe bundle the Material Icons font with AOS? That could be quite handy in general, because then those icons would be available for use in admin UI customisations.
  4. It's not so much an issue of which UTF glyph as which font is used to render the glyph. Each font designer is free to interpret each glyph (e.g. the letter "y", a "left arrow") any way they like, so changing to a different glyph wouldn't necessarily solve the issue. To get the same appearance on all devices you'll need to specify a font that will be available on all devices. Currently the font family is just "sans-serif", which in Windows 10 is Segoe UI, and no doubt something different in MacOS, Android, etc. So you could try and find a font that is included in the system fonts on all OSs. Or you could use the FontAwesome version that is bundled with PW. Or you could include a different webfont as part of Tracy Debugger, e.g. Material Icons. Or you could create your own custom symbol font that just contains the glyphs used in the module, using Fontastic or similar. Or you could use individual SVG icons for all buttons. Heaps of options.
  5. Perfect now, thanks.
  6. Thanks for the update @adrian - having these panels resizeable is a useful feature. I noticed some "twitching" in the console panel - I think due to the scrollbar appearing and disappearing. Maybe this could be avoided with an overflow rule?
  7. There's a long discussion about column width issues in AdminThemeUikit in the issues repo: https://github.com/processwire/processwire-issues/issues/480
  8. I shouldn't think so. The overhead in the search template would be negligible because searches are usually only for a few words at most. In the saveReady hook it would depend on how much content in the page you are saving sounds-like data for. I can't see it being an issue in most circumstances.
  9. I took a quick look at it. The gist of it is that you would set the width of #tracyConsoleContainer with... width: calc(100% - 380px) !important; ...where 380px is whatever the width of #tracySnippetsContainer should be - there is something not quite right there currently, because the snippets container gets a width from an inline style that is narrower than its contents (which overflow). Also this rule... #tracy-debug fieldset { all: initial !important; ... ...would need to be overridden for the console/snippets panels with... width:100% !important; I don't mind it being there permanently myself. I have a wide enough screen that the Ace window is never so narrow that I'd want extra width by collapsing the sidebar. But maybe some people who work on smaller screens would appreciate that.
  10. I'm loving this! On the Console and Snippets panel it seems that only vertical resizing is possible - horizontal resizing there would be handy.
  11. Here's an example with a single "sounds_like" field containing both metaphone and soundex data. This is better I think. In /site/ready.php: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if(!$page->id || !$page->template->hasField('sounds_like')) return; $sounds_like = ''; $words = explode(' ', $page->title); // Get the individual words of field(s) foreach($words as $word) { if(strlen($word) < 3) continue; // Ignore short words $sounds_like .= metaphone($word) . ' ' . soundex($word) . ' '; } $page->sounds_like = $sounds_like; } In search template file: // $q is the sanitized search string $words = explode(' ', $q); $selector = ''; foreach($words as $word) { if(strlen($word) < 3) continue; // Ignore short words $selector .= 'sounds_like~=' . metaphone($word) . '|' . soundex($word) . ', '; } $results = $pages->find($selector);
  12. A different approach which occurred to me is saving sounds-like data to hidden fields on a page and then searching those fields. This allows for other sounds-like algorithms such as metaphone, and allows for "contains" searches rather than only "equals" searches. Notes on the code that follows: You would create hidden fields "metaphones" and "soundex" and then add those to templates as needed. In the example I just save sounds-like data for the title field, but you could include other fields also. Using Double Metaphone would give more accurate results, but I just used metaphone in the example for simplicity. In the search code I am only searching the sounds-like data, but in the real world you would include other fields in the selector also as the "normal" part of the search. In /site/ready.php: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if(!$page->id || !($page->template->hasField('metaphones') && $page->template->hasField('soundex'))) return; $metaphones = ''; $soundex = ''; $words = explode(' ', $page->title); // Get the individual words of field(s) foreach($words as $word) { if(strlen($word) < 3) continue; // Ignore short words $metaphones .= metaphone($word) . ' '; $soundex .= soundex($word) . ' '; } $page->metaphones = $metaphones; $page->soundex = $soundex; }); In search template file: // $q is the sanitized search string $words = explode(' ', $q); $metaphones = ''; $soundex = ''; foreach($words as $word) { if(strlen($word) < 3) continue; // Ignore short words $metaphones .= metaphone($word) . ' '; $soundex .= soundex($word) . ' '; } $selector = "(metaphones~=$metaphones), "; $selector .= "(soundex~=$soundex)"; $results = $pages->find($selector); This allows matching a page title of "The quick brown fox jumps over the lazy dog" by search strings "offer took" and "quiz fogs" thanks to the differences between metaphone and soundex. Don't expect too much from it though - I found plenty of soundalike words that didn't match. The general principle could be expanded with other algorithms, and it would be cool to enhance this by allowing for mixed matches - for example, where in a two word search one word matches metaphone and the second word matches soundex. Edit: on that last point, a simple way would be to use just a single hidden field for both the metaphone and soundex data. The data from those two algorithms is sufficiently different that unwanted matches wouldn't happen. But if other algorithms were added you'd have to check to make sure the data from one algorithm wouldn't be confused with that of another.
  13. Thanks for the new Buster feature! I'm sure you're right here, but some popular performance rating tools such as GTmetrix will deduct points for query strings on static assets, so that might be a reason to prefer filename versioning if clients will be evaluating the website with those tools.
  14. I don't know anything about translations because where I live there is no demand for multi-language websites. I'm sure someone will help you with specifics for that soon. But as some general advice, you'll find that any development problem becomes a lot less confusing and frustrating as soon as you install Tracy Debugger and learn how the basic bardump works. Then you can start dumping variables in your template files, includes and functions and that way find out where your problem lies. I can testify that it's very empowering and greatly reduces feelings of hopelessness.
  15. Welcome @MikeM! Probably not telling you something you don't already know: the project may be simple conceptually, but it won't be a simple development task. You'll need to work with an experienced developer in order to get a good result with this project. PW is an excellent platform to use for just about any web project, and considering where you are posting this you'll probably find lots of people here who will tell you the same thing. But to be honest, there are many platforms that could be used successfully for this project - in reality the success is more likely to come down to the experience and skill of the developer you hire than the platform used. So seeing as you won't be building the site yourself, your task is really to evaluate developers rather than evaluate ProcessWire. That sounds unusual to me - I haven't heard of people developing one site just to serve as an example for another site they want developed. More typical I think is to use a wireframing tool to show the flow of interactions. This helps you clarify to yourself how the website will work and also helps communicate your intentions to the developer. The wireframe could also demonstrate the design if you wanted that, using a tool such as Invision. Here are some links to a few popular wireframing apps if you want to look at that approach instead: https://www.invisionapp.com/ https://www.mockflow.com/ https://wireframe.cc/
  16. Hi @teppo, The Version Control module is preventing the red asterisk from appearing in the header of required fields. The relevant admin CSS is: .InputfieldStateRequired>.InputfieldHeader:first-child:after { content: ' *'; color: #C00C19; } The addition of the field-revisions div interferes with this.
  17. See here:
  18. I was running quite a recent version (only a few weeks old) but not the very latest. Upgrading to the latest has reduced the number of times the textformatter is called, going from four times down to two times. This is not including any field usage in the template file (i.e. I don't get the field value in my template file, so without the Request Info panel active the textformatter isn't called at all). So it's quite an improvement, but still being called one time more often than I would expect. This is the textformatter I'm using for testing: <?php namespace ProcessWire; class TextformatterTest extends Textformatter implements Module { public static function getModuleInfo() { return array( 'title' => 'Textformatter Test', 'version' => '1', 'summary' => 'Testing', ); } public function formatValue(Page $page, Field $field, &$value) { bd('formatValue'); } } The rest of the setup is basically a clean installation of the blank profile. I can definitely live with it as is, but I'll PM you login details for the test site in case you're interested in investigating.
  19. Hi @adrian, I was doing some testing with a textformatter module and was wondering why the formatValue() method was firing so often, even when my template file does not get the field with the textformatter applied. I traced it back to the Request Info panel - when this panel is active the textformatter formatValue() method fires four times (not including any usages of the field in the template file). I see that the panel shows the value of each field in the template in the "Field List & Values" section, but I would have thought this would only account for one firing. Just wondering if something in that panel is getting the field values more often than necessary and could be optimised perhaps?
  20. Not sure if that was a reply to my comment, but Adrian's idea isn't working when I test it with sort settings applied to the parent page or template. I think it would have to be something like this: $parent = $this->editedPage->parent; if($parent->id) { $sort = $parent->template->sortfield ?: $parent->sortfield; } else { $sort = 'sort'; } $first = $this->editedPage->siblings("sort=$sort, limit=1")->first(); $last = $this->editedPage->siblings("sort=-$sort, limit=1")->first(); Getting a single page could be simplified with findOne(), but not sure if you care about supporting < PW 3.0.3 scratch that
  21. What I meant is that they have to learn how to use the core link dialog regardless because I'm sure they'll need to create non-file links, and then they have to also learn a different method if using this module for file links. Glad you have it working how you like. This module isn't likely to get many updates now that it is merged into AOS, but bear in mind if you do see an update available you will need to either avoid updating or reapply your changes to the updated module files.
  22. I have a feeling this won't work where a sort setting has been defined on the parent page or template. When that is done the sort property of the child pages does not change, so doing a reverse sort on that property would result in the wrong order.
  23. @Arcturus, this module's functionality has been merged into AdminOnSteroids. If you are a user of that module it might be better to post your request in the support thread for AOS. If you're not an AOS user then I guess I could make a config option to reverse the click/Alt-click behaviour. Let me know. I'm not keen to go down this road. There are a large number of attributes a link can potentially have and I don't want to try and support them all. This module is intended as a time-saving tool for power-users who are tasked with loading/editing large amounts of content - I have in mind the superuser who must do an initial loading of content supplied by a client. The module isn't intended to be a full replacement of the PW link dialog. For anything beyond what this module provides I suggest you use the link dialog, or perhaps a textformatter module to apply link attributes like target in a systematic way. TBH, if my clients were 60+ and not all that computer literate I would have them stick to the core link dialog so they don't have to learn something new. Edit: you can also add a target attribute to internal file links via a simple piece of jQuery on the front-end: // Add target attribute to internal file links $('a[href^="/site/assets/files/"]').attr('target', '_blank');
  24. For any field that references a page, the syntax to access and search content in the referenced page is the same. You use dot syntax in the form page_reference_field_name.field_name. This applies equally to Page Reference, PageTable and Repeater / Repeater Matrix field types. So if you use a Page Reference field called "social_networks" that contains pages for Facebook, Twitter and LinkedIn, and those pages contain a "body" field that you want to search, your selector would be: social_networks.body%=foo This will match the page that contains the social_network field rather than the referenced pages. So exactly what you are wanting to do.
  25. Yep, sounds good.
×
×
  • Create New...