Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/29/2019 in all areas

  1. We recently relaunched DOMiD, the Documentation center and Museum of Migration in Germany. Concept, design and implementation by schwarzdesign. Features Bilingual site with German and English A section-based design focusing on flexibility and ease-of-use for editors Multiple forms built with FormBuilder that can be placed on any page Separate feeds for news & press releases Lightning fast page loads with almost perfect ratings in Lighthouse Completely accessible and SEO-friendly Notable tech decisions Forms and form placement There are multiple forms for different services that DOMiD offers. Those are built with the FormBuilder. The editors don't have access to the FormBuilder itself, but we still wanted to allow them to control which form is displayed on what page. For this purpose, every page has a select field to select which form to include (if any). Additionally, the form placement has additional fields for a headline and a description, so a generic contact form can be reused in different contexts. Section-based design Most pages are built through Repeater Matrix sections. There are multiple section types available, for example: A generic text / image column with up to three columns of text and images An accordion (rendered as <details> elements). An image gallery Downloads (for files and images, displayed as a list of downloads) External Embed (e.g. YouTube) All sections have an optional headline and a selection of three different background colours. In addition, text columns may be rendered as a coloured block with some padding. This allows for interesting and diverse layouts. Testimonial database One of the available sections is for testimonials or statements (you can see one at the bottom of the homepage). Because one testimonial may be displayed on multiple pages and the client wanted to be able to switch the displayed testimonial on the fly, there's a separate content type for statements. The statement content type has fields for the statement text, author, and author image. The testimonial section only has a page reference field to select which statement to show. This way, the testimonial definition is separate from the placement on a page. Modules used Form Builder Pro Fields (Repeater Matrix in particular) Unique Image Variations ALIF - Admin Links in Frontend Sitemap Wire Mail SMTP Developer Tools: Tracy Debugger, Duplicator, ProcesWire Upgrade Migration museum As a sidenote for anyone living in Germany, this month the German Bundestag has approved funding for DOMiD's first Migration Museum ("Haus der Einwanderungsgesellschaft")! The museum will be build in Cologne and is scheduled to be finished by 2023. We're looking forward to it! Check out this page if you want to learn more, or find out what people are saying about it here.
    8 points
  2. This week we’ll take a quick break from core updates and have a look at a new module called UserActivity, just added to the ProcessWire ProDevTools package— https://processwire.com/blog/posts/user-activity-module/
    7 points
  3. Go to the settings of your CKE field, TAB Details at the bottom are a few options. One of them is: Replace blank alt attributes with image description Check, and done!
    3 points
  4. To hide breadcrumb, I used this hook in ready.php $this->addHookBefore('Process::breadcrumb', function(HookEvent $event) { $Process = $event->object; $Process->wire('breadcrumbs')->removeAll(); });
    2 points
  5. The thing to remember is that this setting is called the "Formatted value", i.e. the value when output formatting is on. When output formatting is off the value of an image field is always a WireArray. And in your code, you specifically turn output formatting off before you work with the field (as you must). If you treat the image field value as an array I think it will work as expected. Something like: $page->of(false); $page->photo->removeAll(); $page->photo->add('https://example.com/img.jpg'); $page->save(); $image = $page->photo->last(); $image->textfield = 'Some text'; $page->save();
    2 points
  6. Wondering how to get that A+ rating on Mozilla Observatory? Now you can with ⭐⭐⭐MarkupContentSecurityPolicy⭐⭐⭐ Of course, MarkupContentSecurityPolicy does not guarantee an A+ rating, but it does help you implement a Content Security Policy for your ProcessWire website. Markup Content Security Policy Configure and implement a Content Security Policy for all front-end HTML pages. This module should only be used in production once it has been fully tested in development. Implementing a Content Security Policy on a site without testing will almost certainly break something! Overview Website Security Auditing Tools such as Mozilla Observatory will only return a high score if a Content Security Policy is implemented. It is therefore desirable to implement one. A common way of adding the Content-Security-Policy header would be to add it to the .htaccess file in the site's root directory. However, this means the policy would also cover the ProcessWire admin, and this limits the level of security policy you can add. The solution is to use the <meta> element to configure a policy, for example: <meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src https://*; child-src 'none';">. MarkupContentSecurityPolicy places this element with your configured policy at the beginning of the <head> element on each HTML page of your site. There are some limitations to using the <meta> element: Not all directives are allowed. These include frame-ancestors, report-uri, and sandbox. The Content-Security-Policy-Report-Only header is not supported, so is not available for use by this module. Configuration To configure this module, go to Modules > Configure > MarkupContentSecurityPolicy. Directives The most commonly used directives are listed, with a field for each. The placeholder values given are examples, not suggestions, but they may provide a useful starting point. You will almost certainly need to use 'unsafe-inline' in the style-src directive as this is required by some modules (e.g. TextformatterVideoEmbed) or frameworks such as UIkit. Should you wish to add any other directives not listed, you can do so by adding them in Any other directives. Please refer to these links for more information on how to configure your policy: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy https://scotthelme.co.uk/content-security-policy-an-introduction/ https://developers.google.com/web/fundamentals/security/csp/ Violation Reporting Because the report-uri directive is not available, when Violation Reporting is enabled a script is added to the <head>which listens for a SecurityPolicyViolationEvent. This script is based on https://developer.mozilla.org/en-US/docs/Web/API/SecurityPolicyViolationEvent and POSTs the generated report to ?csp-violations=1. The module then logs the violation report to csp-violations. Unfortunately, most of the violations that are reported are false positives, and not actual attempts to violate the policy. These are most likely from browser extensions and are not easy to determine and filter. For this reason, there is no option for the report to be emailed when a policy is violated. Instead, you can specify an endpoint for the report to be sent to. This allows you to handle additional reporting in a way that meets your needs. For example, you may want to log all reports in a central location and send out an email once a day to an administrator notifying them of all sites with violations since the last email. Retrieving the Report To retrieve the report at your endpoint, the following can be used: $report = file_get_contents("php://input"); if(!empty($report)) { $report = json_decode($report, 1); if(isset($report) && is_array($report) && isset($report["documentURI"])) { // Do something } } Debug Mode When this is enabled, a range of information is logged to markup-content-security-policy. This is probably most useful when debugging a reporting endpoint. Additional .htaccess Rules To get an A+ score on Mozilla Observatory, besides using HTTPS and enabling the HSTS header, you can also place the following prior to ProcessWire's htaccess directives: Header set Content-Security-Policy "frame-ancestors 'self'" Header set Referrer-Policy "no-referrer-when-downgrade" Installation Download the zip file at Github or clone the repo into your site/modules directory. If you downloaded the zip file, extract it in your sites/modules directory. In your admin, go to Modules > Refresh, then Modules > New, then click on the Install button for this module. ProcessWire >= 3.0.123 is required to use this module.
    1 point
  7. A module created in response to the topic here: Page List Select Multiple Quickly Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page. The screencast says it all: https://github.com/Toutouwai/PageListSelectMultipleQuickly https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    1 point
  8. Yep, it must be installed. It is called Page Path History module, found among the core ones.
    1 point
  9. @Jens Martsch - dotnetic Thanks for the feedback! The search button was missing a translation, I have fixed that. As for the rest of the contents, not everything is translated just because of editorial time constraints (also diminishing returns, not all pages are that important). We usually go with the default behaviour (inheriting from the default language when a translation is missing), because in most cases it's still better to fallback to German instead of having empty sections. Of course, ideally everything would be translated!
    1 point
  10. I like the design of the site, but here is some criticism too: There are german passages on the english site. For example the citation from Dr. Mark Terkessidis on the home page, or the "Suchen" button on the search page. The font in the logo is really bad to read: Fonts before sponsors logo look also bad (bad antialiasing)
    1 point
  11. Thanks @horst, This pointed me in the right direction, looking at some preg_replace examples within that module. I used the online preg_replace tool here: https://www.phpliveregex.com/#tab-preg-replace to finally get what I was looking for: ? $string = '<img alt="" src="/site/assets/files/10877/img_543.jpeg" />'; $pattern = '[\/site\/assets\/files\/(\d){1,20}\/]'; $replacement = '/site/assets/files/' . $page->id . '/'; preg_replace($pattern, $replacement, $string); Output: <img alt="" src=/site/assets/files/<new_page_id>/img_543.jpeg" /> Thanks!
    1 point
  12. On mobile here, but you can do something like that with a Textformatter Module. I remember one that restrict images, it is available in the modules directory. The author is @Martijn Geerts , maybe you can take this as a starting point or just „borough“ some code from it. Edit: the link to the module: https://modules.processwire.com/modules/textformatter-image-interceptor/
    1 point
  13. There is already a feature similar to this - it's the "Name format for children" setting on the template of the parent page. https://processwire.com/docs/modules/guides/process-template/ ID is not one of the supported options, but if you want the page to be named with the ID you can install @kixe's module which extends the functionality of this feature. http://modules.processwire.com/modules/process-setup-page-name/ Or you can enter something like a date format ("Y/m/d H:i:s") in the core "Name format for children" setting, which allows you to skip the Page Add step. And then set the page name and title to the ID with a hook in /site/ready.php: $pages->addHookAfter('added', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'your_child_page_template') { $page->setAndSave([ 'name' => $page->id, 'title' => $page->id, ]); } });
    1 point
  14. @Peter Falkenberg Brown Hello Peter, I've not used this on a new site in a while (ie, not tested on a recent version of PW) but have no doubts the method works as presented above as I'm using on my own internal site to generate invoice numbers. The version of PW I am using there is 3.0.119. If your general approach is the same, (given what you wrote above, I can't tell for sure) then I think this could work for you. Best wishes, Steve
    1 point
  15. Using the API I find cumbersome having to reproduce the individual tasks in sequence that the admin performs by default when trying to accomplish the same goal. I rarely remember how to interact so I have many 'procedures' written as comments in my source to make it easier to find. The trials of old age. ? The original error is because of referencing the 'collection' rather than the individual item. You'll notice in that code snippet that it checks for your field maxfiles setting *and whether there is an image present. If so it removes the existing image before adding the new image to the page image object.
    1 point
  16. New Version 1.0.5 - Fixes empty value bug for FieldtypePage and FieldtypePage::derefAsPageOrFalse setting. @dragan I was trying to reproduce your bug but encountered different one which is also related to FieldtypePage. This probably not related to your bug but try it anyway when you have time.
    1 point
  17. Hi @VeiJari Thanks! ? It seems that my "fix" to support german umlauts in meta tags breaks letters in other languages. ? Can you change the code according to this issue? https://github.com/wanze/SeoMaestro/issues/15 I'll release a version 1.0.1 which fixes this as soon as possible. Cheers
    1 point
  18. Yes. If you want the hook to apply to a specific Lister Pro instance instead of a bookmark you could do this: $wire->addHookBefore('ProcessPageLister::execute', function(HookEvent $event) { /* @var ProcessPageLister $lister */ $lister = $event->object; // If executing a specific Lister Pro instance if($event->wire('page')->name === 'your-lister-page-name') { // Find the templates that contain the meta_title field $tpls = new TemplatesArray(); foreach($event->wire('templates') as $template) { if($template->flags) continue; // Skip system templates (e.g. repeater templates) if($template->fieldgroup->has('meta_title')) $tpls->add($template); } // Set the defaultSelector for the Lister $lister->defaultSelector = "template=$tpls, meta_title=''"; } });
    1 point
  19. Just adding my 2 cents as an encouragement for anyone considering buying pro modules. I am NOT a developer, but have very gladly worked with developers from this wonderful forum. I have bought 5 pro modules so far, also ones I do not use on any of my sites. All of my sites use procache, form builder and repeater matrix. Anybody out there who does not use procache, you are leaving money on the table by not speeding up your site. I try to make a living from my sites, and mostly succeed, and increased speed of my sites so far always translated to more sales, so procache is a must in my book. I bought promailer but do not use it, also prodevtools which I don't even understand what it does, but if Ryan makes it, and I can even slightly understand what it does, I'll just buy as my means of showing appreciation for this incredible piece of art we call processwire, which makes me money every day. I also bought padloper which I do not use, but I bought because I like the idea of a good shopping cart being developed for PW. Sorry for the rant, but I love this thing called Processwire!
    1 point
  20. I had the same problem. Everything was fine on XAMPP but not on the live server. The reason is that on the server there is an apache module installed called mod_security. Add the following code on top of your .htaccess file and the problem will be fixed. <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>
    1 point
  21. @Macrura Thanks for pointing this out. I couldn't find a documentation, about toolbar items available within processwire. I tried all of the CKEditor fullpackage and all items are usable. Here a complete list: Source, Save,NewPage, Preview, Print, Templates Cut, Copy, Paste, PasteText, PasteFromWord, -, Undo, Redo Find, Replace, -, SelectAll, -, Scayt Form, Checkbox, Radio, TextField, Textarea, Select, Button, ImageButton, HiddenField Bold, Italic, Underline, Strike, Subscript, Superscript, -, RemoveFormat NumberedList, BulletedList, -, Outdent, Indent, -, Blockquote, CreateDiv, -, JustifyLeft, JustifyCenter, JustifyRight, JustifyBlock, -, BidiLtr, BidiRtl, Language Link, Unlink, Anchor Image, Flash, Table, HorizontalRule, Smiley, SpecialChar, PageBreak, Iframe Styles, Format, Font, FontSize TextColor, BGColor Maximize, ShowBlocks About
    1 point
×
×
  • Create New...