Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/09/2019 in all areas

  1. Ha ha, you might have spoken too soon. ? I knew that as soon as I posted this a much simpler solution would present itself. You don't need to exclude anything to make an exact match - you just need to match all the pages and the count of the pages. So no helper method is needed really. $matches = $pages->find("template=traveller, countries=Albania, countries=Andorra, countries.count=2"); Or for a more complex match where the count isn't immediately obvious: $value = $pages->find('template=country, title=Albania|Andorra'); // imagine a more complex value than this $selector = $value->each('countries={id}, '); $selector .= "countries.count=$value->count, template=traveller"; $matches = $pages->find($selector);
    8 points
  2. ProcessWire InputfieldRepeaterMatrixDuplicate Thanks to the great ProModule "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use a content module on a different page (e.g. in the same design), you have to rebuild each item manually every time. This module extends the commercial ProModule "RepeaterMatrix" by the function to duplicate repeater items from one page to another page. The condition is that the target field is the same matrix field from which the item is duplicated. This module is currently understood as proof of concept. There are a few limitations that need to be considered. The intention of the module is that this functionality is integrated into the core of RepeaterMatrix and does not require an extra module. Check out the screencast What the module can do Duplicate multible repeater items from one page to another No matter how complex the item is Full support for file and image fields Multilingual support Support of Min and Max settings Live synchronization of clipboard between multiple browser tabs. Copy an item and simply switch the browser tab to the target page and you will immediately see the past button Support of multiple RepeaterMatrix fields on one page Configurable which roles and fields are excluded Configurable dialogs for copy and paste Duplicated items are automatically pasted to the end of the target field and set to hidden status so that changes are not directly published Automatic clipboard update when other items are picked Automatically removes old clipboard data if it is not pasted within 6 hours Delete clipboard itself by clicking the selected item again Benefit: unbelievably fast workflow and content replication What the module can't do Before an item can be duplicated in its current version, the source page must be saved. This means that if you make changes to an item and copy this, the old saved state will be duplicated Dynamic loading is currently not possible. Means no AJAX. When pasting, the target page is saved completely No support for nested repeater items. Currently only first level items can be duplicated. Means a repeater field in a repeater field cannot be duplicated. Workaround: simply duplicate the parent item Dynamic reloading and adding of repeater items cannot be registered. Several interfaces and events from the core are missing. The initialization occurs only once after the page load event Attention, please note! Nested repeaters cannot be supported technically. Therefore a check is made to prevent this. However, a nested repeater can only be detected if the field name ends for example with "_repeater1234". For example, if your MatrixRepeater field is named like this: "content_repeater" or "content_repeater123", this field is identified as nested and the module does not load. In version 2.0.1 the identification has been changed so that a field ending with the name repeater is only detected as nested if at least a two-digit number sequence follows. But to avoid this problem completely, make sure that your repeater matrix field does NOT end with the name "repeater". Changelog 2.0.1 Bug fix: Thanks to @ngrmm I could discover a bug which causes that the module cannot be loaded if the MatrixRepeater field ends with the name "repeater". The code was adjusted and information about the problem was provided 2.0.0 Feature: Copy multiple items at once! The fundament for copying multiple items was created by @Autofahrn - THX! Feature: Optionally you can disable the copy and/or paste dialog Bug fix: A fix suggestion when additional and normal repeater fields are present was contributed by @joshua - THX! 1.0.4 Bug fix: Various bug fixes and improvements in live synchronization Bug fix: Items are no longer inserted when the normal save button is clicked. Only when the past button is explicitly clicked Feature: Support of multiple repeater fields in one page Feature: Support of repeater Min/Max settings Feature: Configurable roles and fields Enhancement: Improved clipboard management Enhancement: Documentation improvement Enhancement: Corrected few typos #1 1.0.3 Feature: Live synchronization Enhancement: Load the module only in the backend Enhancement: Documentation improvement 1.0.2 Bug fix: Various bug fixes and improvements in JS functions Enhancement: Documentation improvement Enhancement: Corrected few typos 1.0.1 Bug fix: Various bug fixes and improvements in the duplication process 1.0.0 Initial release Support this module If this module is useful for you, I am very thankful for your small donation: Donate 5,- Euro (via PayPal – or an amount of your choice. Thank you!) Download this module (Version 2.0.1) > Github: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate > PW module directory: https://modules.processwire.com/modules/inputfield-repeater-matrix-duplicate/ > Old stable version (1.0.4): https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate/releases/tag/1.0.4
    7 points
  3. Nice! Interesting you figured out using count for an exact match. In the same multi-parameter selector mentioned in the linked post, I use count to find messages with either all the age categories checked, or alternatively, it has at least the user's age category checked. This is used because the user's age is not a mandatory field to be completed so if we don't know their age, we need the message to be for all ages, but if we do know their age, then it must match the ages tagged in the message. $selector[] = 'ages=(ages.count='.$pages->count('template=age'), ages=(ages='.$user->age.')'; Anyway, obviously getting away from the purpose of the thread, but it's another example of how using a count can be helpful for queries.
    5 points
  4. I guess it's just CSS? a.InputfieldRepeaterAddLink.InputfieldRepeaterMatrixAddLink.InputfieldRepeaterAddLinkInit[data-type="3"] { font-size: 0; width: 150px; height: 100px; display: inline-block; background-image: url(https://via.placeholder.com/150); background-repeat: no-repeat; } span.ui-priority-secondary { display: none; }
    3 points
  5. See the magic letter d in adrian's last screenshot? ? https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=console
    3 points
  6. Update: you don't need this method. See my next post below. ? ----- Suppose you have a Page Reference field "countries" in template "traveller" that contains any countries the traveller has visited. It's easy to find travellers who have visited Albania and Andorra... $matches = $pages->find("template=traveller, countries=Albania, countries=Andorra"); But what if you want to find travellers who have only visited Albania and Andorra and not visited any other countries? Then it's not so easy. There's no simple syntax for selectors that allows you to match an exact Page Reference field value, as @adrian highlighted recently. Within your selector you have to include all the countries that you don't want to be in the field value. That's a hassle to do manually, and in some circumstances where new pages are being added all the time you may not know in advance all the pages you need to exclude. So to make it an easier job to create an exact match selector for Page Reference fields, here is a helper method you can add in /site/ready.php: // Returns a selector string for matching pages that have the exact supplied value in the Page Reference field $wire->addHookMethod('Field(type=FieldtypePage)::getExactSelector', function(HookEvent $event) { $field = $event->object; $value = $event->arguments(0); if($value instanceof PageArray) $value = $value->explode('id'); if(!is_array($value)) throw new WireException('The $value argument supplied to getExactSelector() must be a PageArray or an array of page IDs.'); $table = $field->getTable(); $query = $this->database->query("SELECT data FROM $table GROUP BY data"); $field_values = $query->fetchAll(\PDO::FETCH_COLUMN); $exclude_ids = array_diff($field_values, $value); $selector = ''; foreach($value as $id) $selector .= "$field->name=$id, "; if(count($exclude_ids)) $selector .= $field->name . '!=' . implode('|', $exclude_ids); $event->return = rtrim($selector, ', '); }); And you use the method like this: // Get the Page Reference field you want to use in the selector $field = $fields->get('countries'); // Get the value you want to match (PageArray) $value = $pages->find('template=country, title=Albania|Andorra'); // Alternatively $value can be an array of page IDs // $value = [1105, 1107]; // Use the method to get a selector string $selector = $field->getExactSelector($value); // Optional: add anything else to the selector that you want $selector .= ', template=traveller'; // Find the matching pages $matches = $pages->find($selector);
    3 points
  7. problem solved! I have to set a unique id -> then the code from my last posting works - without setting the id -> just one page (the last one) is getting added to the page array $p->id = rand();
    2 points
  8. Sensational, Brilliant, Fabulous ? Now this is something we definitely need in the core - I can't believe someone hasn't realized that we can't already do this. I think we need to nominate Robin as PW support guru of the year!
    2 points
  9. It's a Wordpress thread, but it's a great explanation so I thought it was worth linking to: https://wordpress.org/support/topic/why-is-it-an-error-to-have-a-closing-tag-in-functions-php/#post-10430549
    2 points
  10. Eureka! I'm in. Robin's script new user script worked beautifully. Now I have access to the admin panel for the live site and I've got a blank install of PW running on another domain to use as a sandbox so I can figure out if I want to invest a whole bunch of brain cells in PW for future projects. What I'd been doing wrong... I think. I'd been adding a closing delimeter ( ?> ) to the scripts. I thought they were required. I noticed that nobody was using them, so I thought I'd try this one without the close, and voila! This is more of a PHP question than a PW one, but aren't closing delimeters always required? What's different about this case? And thanks for all the help, everybody. It's a big point in PW's favor that it has this active helpful community.
    2 points
  11. The "hookable" icon in the API methods listing is almost invisible - I think it's missing a width rule: Besides the size glitch, I think it would be helpful to make the meaning of this icon a bit more obvious - the single note at the top about it's meaning probably is not enough. Some ideas: Add a label for the column in the table header Add a title tooltip that explains the meaning of the icon on hover Use a different icon than the thunderbolt - didn't the old site have a "hook" icon in this place?
    2 points
  12. A module helping you to manage SEO related tasks like a boss! Automatically generates and maintains a XML sitemap from your pages. Includes a Fieldtype and Inputfield to manage sitemap settings and meta data for pages (Title, Description, Canonical URL, Opengraph, Twitter, Structured Data etc.) Multi language support for the sitemap and meta data. Configure default values for meta data on template level and let pages inherit or overwrite them individually. Map existing fields to meta data, reducing the need to duplicate content. Live preview for content editors how the entered meta data appears on Google. Live preview for content editors how the entered Opengraph data looks like when sharing a page with Facebook. Check out the README on GitHub for more details, including usage instructions. The module is currently released as beta and needs testing! Please report any issues on GitHub or in this forum thread, if you find time to give it a try ? Examples Here is an example of rendered meta data you will get from a single SeoMaestro field: <title>Sed dictum eros quis massa semper rutrum. | acme.com</title> <meta name="description" content="Si lobortis singularis genitus ibidem saluto. Dolore ad nunc, mos accumsan paratus duis suscipit luptatum facilisis macto uxor iaceo quadrum. Demoveo, appellatio elit neque ad commodo ea. Wisi, iaceo, tincidunt at commoveo rusticus et, ludus."> <meta name="keywords" content="Foo,Bar"> <link rel="canonical" href="https://acme.com/en/about/"> <meta property="og:title" content="Sed dictum eros quis massa semper rutrum."> <meta property="og:description" content="Si lobortis singularis genitus ibidem saluto. Dolore ad nunc, mos accumsan paratus duis suscipit luptatum facilisis macto uxor iaceo quadrum. Demoveo, appellatio elit neque ad commodo ea. Wisi, iaceo, tincidunt at commoveo rusticus et, ludus."> <meta property="og:image" content="https://acme.com/site/assets/files/1001/og-image.jpg"> <meta property="og:image:type" content="image/jpg"> <meta property="og:image:width" content="1600"> <meta property="og:image:height" content="1200"> <meta property="og:image:alt" content="Lorem Ipsum"> <meta property="og:type" content="website"> <meta property="og:url" content="https://acme.com/en/about/"> <meta property="og:locale" content="en_EN"> <meta name="twitter:card" content="summary"> <meta name="twitter:creator" content="@schtifu"> <meta name="twitter:site" content="@schtifu"> <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [ { "@type": "ListItem", "position": 1, "name": "About", "item": "https://acme.com/en/about/" } ] } </script> <meta name="generator" content="ProcessWire"> <link rel="alternate" href="https://acme.com/en/about/" hreflang="en"> <link rel="alternate" href="https://acme.com/en/about/" hreflang="x-default"> <link rel="alternate" href="https://acme.com/de/ueber/" hreflang="de"> <link rel="alternate" href="https://acme.com/fi/tietoja/" hreflang="fi"> And some screenshots of the UI:
    1 point
  13. Today's setup for multi-browser / OS testing. Chrome and IE11 on Windows and Safari on the Mac. (Beer not in the frame) ??
    1 point
  14. Yep. And add a nice touch to convert automagically label/link-texts to title attributes, so when the author hovers over an image, he knows exactly what kind of matrix item he/she will add.
    1 point
  15. Exactly. It's just a bit custom CSS. ? It might also be an idea for a matrix update that you can configure labels as images. Would be more flexible.
    1 point
  16. Nice! We know what you were doing in the last few months ?
    1 point
  17. WOW!! Jaw dropped here... I'm really impressed, David! This module and the admin settings you built look incredible. Dumb question: how did you create those matrix thumbnails?
    1 point
  18. AdminTheme Boss with some customizations. ?
    1 point
  19. Thanks for the updates! I spotted a few little issues in InputfieldTagify... There are quotes missing around version, autoload and singular in getModuleInfo(): https://github.com/Sebi2020/InputfieldTagify/blob/354acf86ac88baa8c257523cd093ec202c573fe0/InputfieldTagify.module#L18-L20 PHP gives a warning that InputfieldTagify::renderReady() and InputfieldTagify::___processInput() should be compatible with the methods of the Inputfield class that the module extends. So for renderReady() I think you want: public function renderReady(Inputfield $parent = null, $renderValueMode = false) { $this->addClass("tagify-input"); return parent::renderReady($parent, $renderValueMode); } And for ___processInput(): public function ___processInput(WireInputData $input) { //...
    1 point
  20. I've just released a new pre-release of FieldtypeTags and InputfieldTagify New features include: FieldtypeTags Retrieval of all tags: $this('modules')->get('FieldtypeTags')->getAllTags(); Retrieval of all pages for a specific tag: $this('modules')->get('FieldtypeTags')->getPagesByTag("tagname"); InputfieldTagify Specification of tag limits Downloads: FieldtypeTags v0.1.0-pre: https://github.com/Sebi2020/FieldtypeTags/releases/tag/v0.1.0-pre InputfieldTagify v0.1.0-pre: https://github.com/Sebi2020/InputfieldTagify/releases/tag/v0.1.0-pre Greetings Sebi2020 P.S: Comments appreciated
    1 point
  21. I took a stab at a helper method and posted it here: This makes it easier if you have a more complex definition for selectable pages than simply children, or if you later change the definition for selectable pages and don't want to have to remember to update your code, or if you have a lot of selectable pages (for the selector it only includes pages that have actually been selected somewhere).
    1 point
  22. @MarkE - just be aware that hook doesn't prevent a user getting access to the pages via Pages > Find and also via the Live Search in the menu bar. There are some hooks in the Admin Restrict Branch module that will help you with that though.
    1 point
  23. For anyone interested, I solved this by setting the "User navigation label format" in the AdminThemeUikit module config to an empty string... ...and changed the icon and link href with the following custom JS: // Modify tools menu var $tools_link = $('#tools-toggle'); $tools_link.find('.fa-user-circle').removeClass('fa-user-circle').addClass('fa-wrench'); $tools_link.attr('href', ProcessWire.config.urls.root).attr('target', '_blank');
    1 point
  24. Version 0.4.0 renders some common meta tags not managed by the fieldtype, and fixes a couple of issues reported. Thanks! See https://github.com/wanze/SeoMaestro/releases/tag/v0.4.0 for more information. Cheers
    1 point
  25. The "Copy Content to Other Field" action in Admin Actions could do this, although currently it does it for all pages of the selected template, but wouldn't be difficult to modify to add an additional page selector:
    1 point
  26. Enable debug mode to get more informative error messages. Open file /site/config.php via FTP or hosting file manager and edit the line below to set debug mode true, or add the line if none exists. $config->debug = true; It's possible if the original superuser was deleted, but that's not a common scenario. You could try adding a new superuser account by adding and loading the following "add_user.php" file in the site root. <?php require './index.php'; $u = new User(); $u->name = 'new_user'; $u->pass = '123456'; $u->addRole('superuser'); $u->save(); Edit: by the way, you can also find the names and ids of the existing users by looking in the pages table of the database. In phpMyAdmin or similar, sort the table by the templates_id column, and look at the names and ids of rows where templates_id is 3 (3 is the id of the user template).
    1 point
  27. Love this module, but how come the edit icon that is added to the inputfield is fa-search? I reckon fa-pencil-square-o would be more suitable for an edit icon.
    1 point
  28. I just released version 2 of InputfieldTagify: You can download the zip file from Github: https://github.com/Sebi2020/InputfieldTagify/releases/tag/v0.0.2 @Robin S It now supports configuration of predefined whitelist entries (in this case auto-suggestions) and allows you to enable additional delimiters like spaces and semicolons. I plan to include a option for specifying limits on tags in the next release. Greetings Sebi2020
    1 point
  29. Hi @ryan, could you please add some more detailed documentation for the $page->render() method to the API docs? Currently the details are quite minimal (the method doesn't have it's own page but just a short entry on the $page documentation) and doesn't cover all the options that you describe in this post: I guess the docs for $page->render() need to somehow pull in the PhpDoc comments from PageRender::renderPage().
    1 point
  30. Time for a little update. ? There are many changes again. Most visible: More Ajax, more Drag&Drop, more Wysiwyg. Real containers (Tree hierarchy) instead of "nested groups". Rows are also containers now. In this little video, I will show you how to layout a responsive page from scratch without writing a line of code. http://theowp.bplaced.net/upload/reptile.html This system is not for absolute noobs. You need to have an idea about how responsive web pages and Bootstrap work. But then one can be really fast I think. Still a long way to go, but I hope you like the idea. Thank you.
    1 point
×
×
  • Create New...