Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/24/2019 in all areas

  1. This would only be useful for simple, single-value fields like text fields, right? Because how would it work with an Images field or a Repeater field for example? Anyway, here is a proof-of-concept FileCompiler module: https://github.com/Toutouwai/FileCompilerDataAttributes File Compiler Data Attributes A proof of concept module for populating markup elements according to data attributes containing a field name. Created in response to this forum topic. This approach is really only useful for simple, single-value fields such as text fields as far as I can see. Installation Install the File Compiler Data Attributes module. Setup If you follow the practice of starting your template files with the ProcessWire namespace declaration then for every template you want to use this module with you must change the "Use Compiled File?" option in the template settings from the default option. You must choose either of the "Yes" options depending on what suits you best. I find the need to do this annoying and there is an open issue about it. There is an option in the module config to strip the data-field attribute from the markup when the template file is compiled. Usage In your template files, insert HTML elements (probably empty elements although this is not compulsory) with a data-fieldattribute set according the field name you want to populate the element from. Example: <h1 data-field="title"></h1> <div data-field="body"></div>
    3 points
  2. @BitPoet's groupBy() hook is nice for this sort of thing. As with @teppo's suggestion, you'd have to do a bit more to get it working with infinite scroll (the limit might fall in the middle of a day, in which case you wouldn't want the day heading added again on the next pagination).
    3 points
  3. MarkupMenu is a markup module for generating menu trees. When provided a root page as a starting point, it generates a navigation tree (by default as a HTML "<ul>" element wrapped by a "<nav>" element) from that point onwards. If you've also provided it with current (active) page, the menu will be rendered accordingly, with current item highlighted and items rendered up to that item and its children (unless you disable the "collapsed" option, in which case the full page tree will be rendered instead). Modules directory: https://modules.processwire.com/modules/markup-menu/ GitHub repository: https://github.com/teppokoivula/MarkupMenu Usage As a markup module, MarkupMenu is intended for front-end use, but you can of course use it in a module as well. Typically you'll only need the render() method, which takes an array of options as its only argument: echo $modules->get('MarkupMenu')->render([ 'root_page' => $pages->get(1), 'current_page' => $page, ]); Note: if you omit root_page, site root page is used by default. If you omit current_page, the menu will be rendered, but current (active) page won't be highlighted etc. A slightly more complex example, based on what I'm using on one of my own sites to render a (single-level) top menu: echo $modules->get('MarkupMenu')->render([ 'current_page' => $page, 'templates' => [ 'nav' => '<nav class="{classes} menu--{menu_class_modifier}" aria-label="{aria_label}">%s</nav>', 'item_current' => '<a class="menu__item menu__item--current" href="{item.url}" tabindex="0" aria-label="Current page: {item.title}">{item.title}</a>', ], 'placeholders' => [ 'menu_class_modifier' => 'top', 'aria_label' => 'Main navigation', ], 'include' => [ 'root_page' => true, ], 'exclude' => [ 'level_greater_than' => 1, ], ]); Note: some things you see above may not be entirely sensible, such as the use of {menu_class_modifier} and {aria_label} placeholders. On the actual site the "nav" template is defined in site config, so I can define just these parts on a case-by-case basis while actual nav markup is maintained in one place. Please check out the README file for available render options. I'd very much prefer not to keep this list up to date in multiple places. Basically there are settings for defining "templates" for different parts of the menu (list, item, etc.), include array for defining rules for including in the menu and exclude array for the opposite effect, classes and placeholders arrays for overriding default classes and injecting custom placeholders, etc. ? MarkupMenu vs. MarkupSimpleNavigation TL;DR: this is another take on the same concept. There are many similarities, but also some differences – especially when it comes to the supported options and syntax. If you're currently using MarkupSimpleNavigation then there's probably no reason to switch over. I'd be surprised if someone didn't draw lines between this module and Soma's awesome MarkupSimpleNavigation. Simply put I've been using MSN (...) for years, and it's been great – but there are some issues with it, particularly in the markup generation area, and it also does some things in a way that doesn't quite work for me – the xtemplates thing being one of these. In some ways less about features, and more about style, I guess ? Anyhow, in MarkupMenu I've tried to correct those little hiccups, modernise the default markup, and allow for more flexibility with placeholder variables and additional / different options. MarkupMenu was built for ProcessWire 3.0.112+ and with PHP 7.1+ in mind, it's installable with Composer, and I have a few additional ideas (such as conditional placeholders) still on my todo list. One more small(ish) difference is that MarkupMenu supports overriding default options via $config->MarkupMenu. I find myself redefining the default markup for every site, which until now meant that each site had a wrapper function for MarkupSimpleNavigation (to avoid code / config repetition), and this way I've been able to leave that out ? Requirements ProcessWire >= 3.0.112 PHP >= 7.1.0 If you're working on an earlier version of ProcessWire or PHP, use MarkupSimpleNavigation instead.
    2 points
  4. Is your project_logo field limited to 1 file only? If not... either change the limit in the settings to 1 or place your image code into a foreach() I'd recommend the first option.
    2 points
  5. That trailer though is pretty epic. ?
    2 points
  6. Repeater Images Adds options to modify Repeater fields to make them convenient for "page-per-image" usage. Using a page-per-image approach allows for additional fields to be associated with each image, to record things such as photographer, date, license, links, etc. When Repeater Images is enabled for a Repeater field the module changes the appearance of the Repeater inputfield to be similar (but not identical) to an Images field. The collapsed view shows a thumbnail for each Repeater item, and items can be expanded for field editing. Screencast Installation Install the Repeater Images module. Setup Create an image field to use in the Repeater field. Recommended settings for the image field are "Maximum files allowed" set to 1 and "Formatted value" set to "Single item (null if empty)". Create a Repeater field. Add the image field to the Repeater. If you want additional fields in the Repeater create and add these also. Repeater Images configuration Tick the "Activate Repeater Images for this Repeater field" checkbox. In the "Image field within Repeater" dropdown select the single image field. You must save the Repeater field settings to see any newly added Image fields in the dropdown. Adjust the image thumbnail height if you want (unlike the core Images field there is no slider to change thumbnail height within Page Edit). Note: the depth option for Repeater fields is not compatible with the Repeater Images module. Image uploads feature There is a checkbox to activate image uploads. This feature allows users to quickly and easily add images to the Repeater Images field by uploading them to an adjacent "upload" field. To use this feature you must add the image field selected in the Repeater Images config to the template of the page containing the Repeater Images field - immediately above or below the Repeater Images field would be a good position. It's recommended to set the label for this field in template context to "Upload images" or similar, and set the visibility of the field to "Closed" so that it takes up less room when it's not being used. Note that when you drag images to a closed Images field it will automatically open. You don't need to worry about the "Maximum files allowed" setting because the Repeater Images module overrides this for the upload field. New Repeater items will be created from the images uploaded to the upload field when the page is saved. The user can add descriptions and tags to the images while they are still in the upload field and these will be retained in the Repeater items. Images are automatically deleted from the upload field when the page is saved. Tips The "Use accordion mode?" option in the Repeater field settings is useful for keeping the inputfield compact, with only one image item open for editing at a time. The "Repeater item labels" setting determines what is shown in the thumbnail overlay on hover. Example for an image field named "image": {image.basename} ({image.width}x{image.height}) https://github.com/Toutouwai/RepeaterImages https://modules.processwire.com/modules/repeater-images/
    1 point
  7. This week I've been working on core 3.0.134 but am going to keep the version number at 3.0.133 for another week while I continue with updates there. Commit log. One of the updates already present that I'm finding quite useful is a nice upgrade to InputfieldSelector (like used by Lister and ListerPro) which simplifies the field selection process as there are no longer separate "Field" and "Field…" selections for fields that have subfields, and they are now bundled into one. This reduces the number of selectable fields and likewise speeds up the selecting/filtering process. I'll have more details on that next week, along with other updates. I'm going to be working remotely next week (not vacation) and do not yet know what the internet situation is going to be yet, so on the chance that I don't have good internet access, I may not have an update next week, but hopefully will. Have a great weekend!
    1 point
  8. Thank you @Robin Sand @tpr for taking the time to respond. I tried Robin's solution and worked beautifully thanks. It's working well, I've enabled that option in one of my sites and I'm about to do it for all of them. Even though I had gone through the field options in the body field, I somehow missed the "Counter" option! ? [facepalm moment] I really appreciate this. I had no idea this feature was already in ProcessWire! So, no need to add it to wish list. Sorry! I will mark the thread as solved, and maybe a moderator would be kind enough to move it out of wishlist category... or is that something I can do myself? Anyway thank you both for solving the problem and hopefully anyone searching the forums will now see that this feature already exists.
    1 point
  9. Nice module, but I would prefer push notifications dependent on used browser only instead of an additional push provider. It works with that demo cross browser (with system-worker web push api support). https://webpushdemo.azurewebsites.net/
    1 point
  10. Perhaps I'm missing the point, but this should be the easy part. Maybe something along these lines: <?php $current_date = null; $items = $pages->find('template=news-item, sort=date_field, start=0, limit=20'); if ($items->count()) { foreach ($items as $item) { $date = date('j.n.', $item->getUnformatted('date_field')); if ($date !== $current_date) { if ($current_date !== null) echo "</ul>"; echo "<h3>{$date}</h3><ul>"; $current_date = $date; } echo "<li>{$item->title}</li>"; } echo "<ul>"; } It's a bit crude and probably wouldn't work as-is with your infinite scroll approach, but that's the basic idea anyway ?
    1 point
  11. Right – WSL 2 is indeed an awesome concept. Kind of like having a real Linux box to work with (kidding ?) When it comes to the terminal app, I guess it's just the fact that it's a desperately needed upgrade that makes folks happy. Good for them – and good for me I guess, if I ever have to touch a Windows machine again. Never say never, and so on and so forth ?
    1 point
  12. Thanks @Robin S, somehow I thought the built-in one didn't work for CKEditors but it's not true. Just tried it and worked fine for a multi-language field as well, and showed the same values as the CKEditor plugin. According to the CKEditor plugin's documentation it offers more advanced configuration though.
    1 point
  13. Also, there is a counter option built into PW for all textarea fields:
    1 point
  14. Just add this plugin: https://ckeditor.com/cke4/addon/wordcount Or use AdminOnSteroids module which comtains this plugin.
    1 point
  15. Hi @Juergen This should work: $page->seo->robots->noIndex = 1; $page->seo->robots->noFollow = 1; Cheers
    1 point
  16. @schwarzdesign I just noticed that you block /api with your robots.txt: https://architekturfuehrer.koeln/robots.txt Don't do that. This is most probably the reason Google can't index your Vue-powered site. You can check what Googlebot really sees here: https://search.google.com/test/mobile-friendly In your case, it's the empty, unpopulated Vue app tag. Not even the app shell is visible. When I checked another Vue site earlier this week, Google actually reported issues when confrontend with a bot-blocking robots.txt rule. (another one was a missing cross-origin HTTP header, which doesn't apply for your site, since you're not loading anything from another domain)
    1 point
  17. TLDR: Buy ProFields I don't understand why that brief list of fields is a "mess and a nightmare". I know the general advice given is to reuse fields where possible but I think people sometimes take this suggestion a bit too seriously. Create the fields you need and forget stressing about whether you have perfectly optimised the reuse of fields. If you have less than, say, 100 fields in your site you really have nothing to worry about. I think I saw a post recently where Lost Kobrakai was talking about a site of his with over 800 fields. But ProFields... You mention client editing experience, so I take that to mean you (like me) earn an income from developing websites. With that in mind here are some things to consider when making your decision whether or not to purchase ProFields... Have you thought about how lucky we developers are that we can earn an income with virtually no overhead costs? With so much fantastic open-source software made available to us at no cost we are in a very fortunate position. We could design and develop websites entirely with free software if we so choose. Hell, if we wanted we could go to the landfill and probably pick up a free old computer that would be perfectly adequate to develop a website on. Now think about the carpenters and dentists and all those other professions that must purchase real physical tools (that wear out) in order to earn a living. £100 doesn't go very far if you need to buy a table saw. On the topic of open-source, think about what Mr Ryan Cramer has provided us with in ProcessWire. People with his level of skill do not need to be contributing their time for free to open-source projects - they are in very high demand for all kinds of lucrative work. Purchasing a Pro module from Ryan is a way to show appreciation for the generous work he puts into PW. PW is not just great free software, it is great software full-stop. You mention previously having worked with Drupal and Craft CMS. Time is money, so think of all the money you have saved by the quick development workflow that PW allows vs Drupal. And Craft CMS costs USD$299 per website and is still not as powerful as the PW core. Ryan's Pro modules are insanely good value for money. The price that you can purchase a dev license that allows you unlimited use of the modules is more than reasonable. For comparison, here is one of the most popular addons for Concrete5: http://www.concrete5.org/marketplace/addons/block-designer-pro There is no unlimited license, and a license for 5 installations costs USD$276.25. And it requires "Block Designer" so that's another USD$120 for 5 installations, bringing the cost to USD$396.25. I haven't used it but it looks like it is basically the equivalent of Repeater Matrix. But probably not as elegant. And with ProFields you get another four modules bundled in. For unlimited use. For USD$129. Hope this has helped make the decision a little easier.
    1 point
  18. I personally use Horst module wireMailSMTP configured with Amazon SES and a simple code + cronjob. <?php // some config variables //these two variables should match the cronjob setting. $hour_interval = 9; // interval time in hours the cronjob is working, ex.: from 14:00 to 23:00 $cron_minute = 5; // cronjob execution every tot minute. $daily_sends = ($hour_interval * 60) / $cron_minute; $max_days = 5; // for how long I want to send the newsletter in a week ? max 7 days // this variable tells me how many times I have to send the newsletter based on the previous variables. $total_sends = $daily_sends * $max_days; $total_users = $users->find("privacy_newsletter=1,roles!=1016,limit=2")->getTotal(); // this limit tells me how many users I have to select per send to complete all the newsletter in the interval I configured previously ($max_days + cronjob settings) $limit = round( $total_users / $total_sends ); /******** INIT THE MAIL **********/ $mail = wireMail(); /******** IF ALL CICLES ARE COMPLETED RESET THE MAIL SENT LOG **********/ // 'cicles' field is an integer incremented every newsletter send if($page->cicles >= $total_sends){ $mail->sentLogReset(); // reset cicles variables $page->of(false); $page->cicles = 0; $page->save(); $page->of(true); } /******** SET THE START FOR USER SELECTION **********/ $start = $page->cicles * $limit; /******** USER SELECTION **********/ $members = $users->find("privacy_newsletter=1,roles!=1016,sort=created,start=$start,limit=$limit"); $to = $members->explode('email'); $mail->to($to); /******** SET THE NEWSLETTER CONTENT **********/ $mail->subject("LATEST NEWS"); $mail->bodyHTML($page->newsletter->last()->bodyhtml); // 'newsletter' field is s repeater with just a textarea field, the current newsletter is the latest item of the page. /******** SEND NEWSLETTER **********/ $numSent = $mail->sendBulk(true)->useSentLog(true)->send(); $page->of(false); $page->cicles++; $page->save(); $page->of(true); I just created a page with this template and call the url from cronjob. I'm still optimizing some steps but right now it's working well . Next step is create the cronjob directly from php using some libraries i'm studying so I don't have to check my variables and the cronjob. I send 2-3k mails per day and using Amazon is really cheap compared to other systems.
    1 point
  19. I just tested it and I think this is what you want. Here’s a complete demo module: class NotFoundIntercept extends Wire implements Module { public static function getModuleInfo() { return array( 'title' => 'Not Found Intercept ', 'version' => 001, 'summary' => 'Hooks into pageNotFound so you can handle URLs that don’t belong to any page.', 'href' => 'https://processwire.com/talk/topic/8510-module-intercept-ajax-call/', 'autoload' => true, ); } public function init() { wire()->addHook('ProcessPageView::pageNotFound', $this, 'intercept404'); } protected function intercept404($event) { $url = $event->arguments('url'); if ($url != '/my_pseudo_page/') return; //Let pageNotFound() handle it header($_SERVER['SERVER_PROTOCOL'] . ' 200 OK', true, 200); $name = $_GET['name']; if ($name) die("Hola $name! Como estas?"); else die("Sup, guest?"); } } Now you can open ejemplo.es/my_pseudo_page/?name=Manol and – provided that page doesn’t exist in PW – it will greet you. Of course, if the front page has urlSegments enabled, it will just accept that instead, and your module won’t be triggered...
    1 point
  20. $pageArray->has($page); http://processwire.c...er=has Also it doesn't matter if you add duplicates as PW will remove them anyway.
    1 point
×
×
  • Create New...