Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/02/2024 in all areas

  1. Inputfield Dependency Helper Adds "Insert field name" and "Insert value" dropdown menus to help with constructing show-if/required-if conditions, aka inputfield dependencies. The "Insert field name" menu helps you remember the field names that exist in your site (or exist in the current template) and avoids typos. The "Insert value" menu lets you select values for Page Reference or Select Options fields via the human-friendly label whereas the show-if/required-if conditions require those values to be inserted as numerical IDs. Insert field name When you click the button a dropdown menu appears listing field names, with the field labels in parentheses. When editing a field in template context only the fields that exist in the template are listed, and the field labels are in template context. When editing a field outside of template context all the non-system fields are listed. When you click an item in the list the field name is inserted into the settings field. Insert value When using a Page Reference or Select Options field value in a show-if/required-if condition you have to enter the numerical ID of the page/option, and this is not so user-friendly – often you have to switch to another tab and go and look up the relevant ID. The "Insert value" button is intended to make this process easier. When you click the button a dropdown menu appears listing any Page Reference and Select Options fields that exist in the current template (when editing in template context) or in the site. When you click one of the fields the selectable options for the field are AJAX-loaded into a flyout menu. Clicking one of the selectable options will insert the numerical ID of the option into the settings field. Configuration In the module config you can set a limit to the number of selectable options shown in the menu, so the menu doesn't get excessively long. https://github.com/Toutouwai/InputfieldDependencyHelper https://processwire.com/modules/inputfield-dependency-helper/
    6 points
  2. Thanks. That's an unknown. It's not worth the time of making a PR if Ryan doesn't want it as a PR. When it's a module I and everyone else can use it right away. When it's a PR then it's something that maybe becomes usable someday, maybe not...
    3 points
  3. Hey ProcessWire community! I'm excited to introduce RockCalendar, a new calendar module that brings powerful event management capabilities to your ProcessWire sites. Key features include: Full calendar view in the ProcessWire admin Easy event creation and management Drag-and-drop event scheduling Recurring events (SSE powered, needs RockGrid) Seamless integration with ProcessWire pages and fields I've created a detailed video walkthrough showcasing RockCalendar's features and installation process: Check it out and let me know what you think! I'm here to answer any questions you might have about RockCalendar. Download & Docs: https://www.baumrock.com/en/processwire/modules/rockcalendar/ Happy coding!
    2 points
  4. this still works in 2024 :) (answering my own question from 2013 haha)
    1 point
  5. Looks great. Wouldn't that be worth a PR?
    1 point
  6. Thanks Bernhard, now the Ajax endpoints also work with .latte as file extension. πŸ™‚ πŸ‘
    1 point
  7. Hey @zoeck thx yeah that test2.l was helpful and I've fixed that in v3.21.2
    1 point
  8. Hey @zoeck thx. I just tried and it seems to work. What exactly do you mean by "didn't work"? Steps to reproduce please.
    1 point
  9. Hello Bernhard, extremely nice feature! I need just such a function πŸ™‚ I only noticed one small thing, in the documentation it says that it must be a PHP file in the AJAX directory, in the Rockfrontend Config it says the following: I also tried it with a .latte file and that didn't work. Is this function still missing or is this just a wrong text? Thank you for your great modules!
    1 point
  10. You probably want to exclude by template for the "Link to URL" autocomplete field too. // ProcessPageEditLink > Link to URL: exclude pages by template $wire->addHookBefore('InputfieldPageAutocomplete(name=link_page_url)::render', function(HookEvent $event) { $inputfield = $event->object; $exclude_templates = ['basic_page', 'movies']; $inputfield->findPagesSelector .= ', template!=' . implode('|', $exclude_templates); }); // ProcessPageEditLink > Select Page / Select Child Page: exclude pages by template $wire->addHookAfter('ProcessPageEditLink::execute', function(HookEvent $event) { $exclude_templates = ['basic_page', 'movies']; $css = ''; foreach($exclude_templates as $template_name) { // Hide the page list item (and its children) $css .= ".PageListTemplate_$template_name, "; // Or just hide the "Choose page" button, if the child pages should remain selectable // $css .= ".PageListTemplate_$template_name .PageListActionSelect, "; } $css = rtrim($css, ', '); $css .= ' { display:none !important; }'; $event->return .= "<style>$css</style>"; });
    1 point
  11. RockMigrations v5.3.0 Added an automatic Modules::refresh() before executing $rm->installModule() Added GET_PHP_COMMAND for deployments as requested by @snck Added docs for the great filesOnDemand feature
    1 point
  12. RockFrontend v3.21.1 Several improvements in the docs Added support for nested AJAX Endpoints (see video below)
    1 point
  13. My internet persona was born in these sort of forums when I was a teen, and I think it'll die on this hill! I REALLY appreciate having a forum for ProcessWire! Wouldn't exaggerate to say it's one of the reasons I've found myself so comfortable in the community.
    1 point
  14. That helps. Ok I tried the following: // _main.latte {include 'test.latte'} // test.latte {bd($wire)} // result // $wire is a ProcessWire object Next using {embed} // _main.latte {embed 'test.latte'}{/embed} // test.latte {bd($wire)} // result // $wire is NULL This is exactly the behaviour that the docs state: That's what I wished you provided, so I can easily try things out and can follow. But seems we are there now. Yes. Always remember LATTE = PHP, so you can do this, for example: {extract(\ProcessWire\wire('all')->getArray())} {bd($wire)} {bd($modules)} As you can see when adding the namespace to any function api it will also work! Again, it's just PHP. Or you could also do this: // _main.latte {embed 'test.latte', api: get_defined_vars()}{/embed} I'm sorry, but I'm not going to try to guess what you mean. Actually I tried, but unless you provide a simple step by step example like I did above I can't help, as I don't know/understand what the problem is. Maybe you already mentioned it, but I can't remember everything you wrote and showed in one of the extensive examples. I know you are busy, but so am I, so it would be nice to make it easier for me to follow and help πŸ˜‰
    1 point
  15. Search Corrections Suggests alternative words for a given input word. This can be useful in a website search feature where the given search term produces no results, but an alternative spelling or stem of the term may produce results. The module has two methods intended for public use: findSimilarWords(): this method suggests corrected spellings or similar alternatives for the given word based on words that exist in the website. stem(): this method returns the stem of the given word, which may give a full or partial match for a word within the website. The module doesn't dictate any particular way of using it in a website search feature, but one possible approach is as follows. If a search produces no matching pages you can take the search term (or if multiple terms, split and then loop over each term) and use the module methods to find alternative words and/or the stem word. Then automatically perform a new search using the alternative word(s), and show a notice to the user, e.g. Your search for "begining" produced no matches. Including results for "beginning" and "begin". findSimilarWords() This method creates a list of unique words (the "word list") that exist on the pages and fields that you define, and compares those words to a target word that you give it. The method returns an array of words that are sufficiently similar to the target word. For multi-language sites, the $user language determines which language populates the word list. Similarity The method ranks similar words by calculating the Levenshtein distance from the target word. Where several results have the same Levenshtein distance from the target word these are ordered so that results which have more letters in common with the target word at the start of the result word are higher in the order. Method arguments $target (string) The input word. $selector (string) A selector string to find the pages that the word list will be derived from. $fields (array) An array of field names that the word list will be derived from. $options (array) Optional: an array of options as described below. minWordLength (int) Words below this length will not be included in the word list. Default: 4 lengthRange (int) Words that are longer or shorter than the target word by more than this number will not be included in the word list. Default: 2 expire (int) The word list is cached for this number of seconds, to improve performance. Default: 3600 maxChangePercent (int) When the Levenshtein distance between a word and the target word is calculated, the distance is then converted into a percentage of changed letters relative to the target word. Words that have a higher percentage change than this value are not included in the results. Default: 50 insertionCost (int) This is an optional argument for the PHP levenshtein() function. See the docs for details. Default: 1 replacementCost (int) This is an optional argument for the PHP levenshtein() function. See the docs for details. Default: 1 deletionCost (int) This is an optional argument for the PHP levenshtein() function. See the docs for details. Default: 1 Example of use // The input word that may need correcting $target = 'dispraxia'; // Get the Search Corrections module $sc = $modules->get('SearchCorrections'); // Define a selector string to find the pages that the word list will be derived from $selector = "template=basic-page"; // Define an array of field names that the word list will be derived from $flds = ['title', 'body']; // Optional: override any of the default options $options = ['maxChangePercent' => 55]; // Get an array of similar words that exist in the pages/fields you defined // The return value is in the format $word => $levenshtein_distance $results = $sc->findSimilarWords($target, $selector, $flds, $options); Example result: stem() This method uses php-stemmer to return the stem of the given word. As an example, "fish" is the stem of "fishing", "fished", and "fisher". The returned stem may be the original given word in some cases. The stem is not necessarily a complete word, e.g. the stem of "argued" is "argu". If using the stem in a search you will probably want to use a selector operator that can match partial words. Method arguments $word (string) The input word. $language (string) Optional: the language name in English. The valid options are shown below. Default: english catalan danish dutch english finnish french german italian norwegian portuguese romanian russian spanish swedish Alternatively, you can use the ISO 639 language code for any of the above languages. Example of use // The input word $word = 'fishing'; // Get the Search Corrections module $sc = $modules->get('SearchCorrections'); // Get the stem of the word $stem = $sc->stem($word); https://github.com/Toutouwai/SearchCorrections https://processwire.com/modules/search-corrections/
    1 point
  16. Hi @joe_g $pages->addHookAfter('added', function(HookEvent $event) { $pages = $event->object; // The page that is being added $page = $event->arguments(0); // If the page passes some kind of test if($page->template == 'your-template-name') { // Set the sort value for the new page to zero (sibling sort will be automatically adjusted) $pages->sort($page, 0); } }); Put this piece of code into the ready.php. Hope this help. Gideon
    1 point
  17. You need to add "check_access=0" to the selector.
    1 point
Γ—
Γ—
  • Create New...