Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/13/2019 in all areas

  1. Work continued in closing out issue reports this week. We’re down to about 60 of them now, though if we subtract issues that aren’t reproducible, are already marked as resolved (close pending), may be moved to the request repo, or are a discussion (rather than something to fix), then we’re closer to half that number. Over these last few weeks we’ve been working on issue reports, but I’ve also been enhancing the core in small ways as well. This post will cover a few of the useful enhancements that have been made in recent weeks— https://processwire.com/blog/posts/pw-3.0.130/
    4 points
  2. File Info A textformatter module for ProcessWire. The module can add information to local Pagefile links in two ways: As extra markup before, within or after the link As data attributes on the link (handy if you want to use a Javascript tooltip library, for instance) Screenshots Module config Example of output Installation Install the File Info module. Add the textformatter to one or more CKEditor fields. Configuration Add markup action (and general) Select "Add markup to links" Select the Pagefile attributes that will be retrieved. The attribute "filesizeStrCustom" is similar to the core "filesizeStr" attribute but allows for setting a custom number of decimal places. If you select the "modified" or "created" attributes then you can define a date format for the value. Enter a class string to add to the links if needed. Define the markup that will be added to the links. Surround Pagefile attribute names in {brackets}. Attributes must be selected in the "Pagefile attributes" section in order to be available in the added markup. If you want include a space character at the start or end of the markup then you'll need >= PW 3.0.128. Select where the markup should be added: prepended or appended within the link, before the link, or after the link. Add data attributes action Select "Add data attributes to links" Select the Pagefile attributes that will be retrieved. These attributes will be added to the file links as data attributes. Attributes with camelcase names will be converted to data attribute names that are all lowercase, i.e. filesizeStrCustom becomes data-filesizestrcustom. Hook If you want to customise or add to the attributes that are retrieved from the Pagefile you can hook TextformatterFileInfo::getFileAttributes(). For example: $wire->addHookAfter('TextformatterFileInfo::getFileAttributes', function(HookEvent $event) { $pagefile = $event->arguments(0); $page = $event->arguments(1); $field = $event->arguments(2); $attributes = $event->return; // Add a new attribute $attributes['sizeNote'] = $pagefile->filesize > 10000000 ? 'This file is pretty big' : 'This file is not so big'; $event->return = $attributes; }); https://github.com/Toutouwai/TextformatterFileInfo https://modules.processwire.com/modules/textformatter-file-info/
    4 points
  3. I've been using a very similar solution at weekly.pw, i.e. indexing data into a field called "search_index". The content is mostly built using PageTable, and I'm indexing content from those for the parent page's search_index field as well. No Repeaters or RepeaterMatrix fields here, but they'd require similar processing. The whole solution is built into some methods placed in /site/init.php. Might be useful for someone, so here's the code: https://gist.github.com/teppokoivula/83036c6e73d7460be7706def620d80d4. Note that in this case I'm not using the same index as an excerpt, but rather the summary field of the page. Excerpt would be better – will probably add them at some point. Once you have the index at hand, it's relatively simple ? Another thing to note here is that I'm currently using the same index field to store links in link:url format. Since tags are stripped from the index text, URLs wouldn't otherwise be a part of the index – and this also allows me to perform specific link queries, such as https://weekly.pw/search/?q=link:https://modules.processwire.com/modules/sanitizer-transliterate/ ?
    3 points
  4. @thetuningspoon - if you go with Dynamic Roles, please grab this fork (https://github.com/matjazpotocnik/DynamicRoles/commits/master) by @matjazp because Ryan's version is pretty broken and seemingly abandoned.
    2 points
  5. There's a bit more more work needed before my module could be released publicly but I'll put it on my "to do" list. Yes, but in my use cases that's a good thing. This approach only suits certain types of search needs, where you want to implement a broad text search across most/all content. In my cases I want the search to match as many pages as possible, so I do things like explode the search phrase on space characters and then match each term with the %= LIKE operator so I'm catching part words too and without regard to the order of terms: $search_terms = $sanitizer->selectorValue($input->get->search); $search_terms = preg_replace("/\s+/", " ", $search_terms); // replace multiple spaces with single space $terms = explode(' ', $search_terms); foreach($terms as $term) { $selector .= "index%=$term, "; } //... And I want the excerpt to be Google-like in that it deals with the page's text content as a whole rather than caring about what fields were used behind the scenes.
    2 points
  6. When creating a new page with multilanguage page names, under the Settings tab there is a field for the page name for each language with an "Active" checkbox. By default the chachbox is checked How can I set them to be unchecked by default? I tried to find settings in LanguageSupport and LanguageSupportPageNames modules and in the settings for the languages.
    1 point
  7. Right good ok that's what I thought. ProcessWire is my favorite though
    1 point
  8. Here is a discussion related to this issue, in which Ryan explains the API decisions: https://processwire.com/talk/topic/11736-get-requests-not-subject-to-access-control To sum it up real quick (quotes): A $pages->find() or $pages->findOne() method that filters results is based on database-filtering, not runtime filtering. The API is based around providing methods for the developer to control access the way they see fit. The viewable() method is the basis of that. PW's access control model supports runtime hooks to Page::viewable. One shouldn't skip a $page->viewable() call regardless of what method you used to retrieve the page. When rendering frontend templates <?php if ($page->viewable()) : ?> (or $page->viewable('field_name'); ) is the way to go to check for default PW permissions. For example: https://processwire.com/talk/topic/4834-simple-hooks-tutorial-turn-a-pagearray-into-a-list-of-links/ ... // loop through each item in the PageArray and render some links foreach($event->object as $page) { $value = $page->get($property); if(!strlen($value)) continue; // skip empty values if(strlen($out)) $out .= $delimiter; if($page->viewable()) { $out .= "<a href='$page->url'>$value</a>"; // if page is viewable, make it a link } else { $out .= $value; // if page is not viewable, just display the value } } ... In order to "extend" the access control logic, one can hook after Page::viewable eg.: https://github.com/processwire/processwire-issues/issues/560#issuecomment-384656192 quote: // goes into /site/ready.php $wire->addHookAfter('Page::viewable', function($event) { $viewable = $event->return; if($viewable) return; // use PW's existing logic, since it said it was viewable $page = $event->object; if(!$page instanceof User) return; // this is an example for User templates only if(whatever logic you decide that $page is viewable) { $viewable = true; $event->return = $viewable; } });
    1 point
  9. I have done this (product migration from A to Shopify) and it is fairly simple using Shopify's API and a Shopify private app. I have used this library . Probably what is more time consuming is understanding Shopify's API endpoints. (e.g. took me some time to understand all shopify product objects actually have at least one variant object, where the actual price is kept!) My doubt is, do you plan to completely deprecate the PW website? Or do you plan to embed Shopify somehow into the existing site?
    1 point
  10. Probably someone with experience in graphql can build a similar connector plugin for PW like https://github.com/jasonmccallister/craft-hasura Do you think that it would be a good idea?
    1 point
  11. Hey @ryan, great update! I wonder if the new CacheRender function can also be used for repeaters or repeater matrix items? Like this: foreach($page->repeater_field as $item) { echo $cache->renderFile($item->render(), WireCache::expireSave); } It would be great, especially with a lot of repeater items and outsourced render files the rendering can take a few seconds.
    1 point
  12. It is now, thanks @Pete
    1 point
  13. It's actually not that hard to customize it via CSS. I posted some example code in the forum some time ago, but can't find it right now... Also, maybe check out this thread:
    1 point
  14. Hi there, That's somewhat odd question to post to a support forum dedicated ProcessWire, a PHP based CMS/CMF – but no worries, here in the Off Topic area all questions are fine ? Personally I've not used Redux that much, but have you already checked their own tutorials? The basic tutorial (https://redux.js.org/basics/basic-tutorial) and the advanced tutorial (https://redux.js.org/advanced/advanced-tutorial) should give you a solid understanding of Redux.
    1 point
  15. Nice update, although I don't think the version bump was committed.
    1 point
  16. Having a look at https://documentation.mailgun.com/en/latest/api-sending.html#sending inline is a separate parameter that would need to be implemented. I’ll have a look at this on Monday when I’m back at the coalface. ? Chris
    1 point
  17. With all the hype around headless CMS, maybe a new GraphQL module? The only one we already have, uses an abandoned PHP library, and is much too slow for productive use imho.
    1 point
  18. general: sqlite and xml databases add greatly to portability range: xml database works very well up to the 500 pages website range speed: xml database makes a website much faster compared to sql
    1 point
  19. There have been, and still are, requests for adding sqlite to PW. Perhaps that would give you something to work on commercially. Besides sqlite database, how much would it roughly cost to add xml database to PW ?
    1 point
  20. Perhaps this will help? Oh, and welcome to the forum! ?
    1 point
  21. This looks very nice @Noel Boss, is there a way to support repeater fields? EDIT: Sorry for my silly question, found it in your docs. This works for me: $query = ['repeater' => function($page){ return array_column($page->get('repeater')->each(['key', 'body']), 'body', 'key');
    1 point
  22. You can process the queue by calling a script manually, from a seperate cronjob or for example from LazyCron. <?php $modules->get('IftRunner')->processQueue(); // Or if you want to specify how many queues must be executed you can also set a maximum $max = 5; // or whatever how many you want to be executed $modules->get('IftRunner')->processQueue($max);
    1 point
×
×
  • Create New...