Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by olafgleba

  1. Same here. 1. When System in debug mode is checked with $config->debug = true, the hidden pages do not show up in the page list. Switching to $config->debug = false the hidden pages are shown in page list. 2. When Current user is superuser is checked being logged in as a superuser, the hidden pages do not show up in the page list. Except i misunderstand the feature, i guess the except condition just has to be swapped/needs a little adjustment. Apart from that, thank you @ryan. This really is a very helpful new setting!
  2. And installing less in addition. Really no big deal, but just saying 🙂
  3. Hi @bernhard, thanks for answering. I know this as well while working for agencies (freelance),- adapting to their environment. But if i have the choice, i stick with my current dev environment that all is build around Gulp and its ecosystem. And browersync intergrates here very smoothly. I guess thats one reason i stick for it for quite a time yet.
  4. Thx. The latest ProField Repeater Matrix has the option (input tab) to define the method for adding items. When you choose Images you get the overlay. By default, the image of the matrix type have the same name and be placed along with the type file location (for example: /site/templates/fields/modules_page/matrix_type.php => site/templates/fields/modules_page/matrix_type.svg). Preparing a good looking Image is just up to you then 😉
  5. Just because there is no need for this extra. The client is happy what he got. Coming from Typo3...
  6. A week ago the new website of the wuppermann group went online. The Wupperman group is a EU-wide operating company with several locations in different countries. Their portfolio is all about steel fabrication. This includes flat producs and tubes & profiles. The technical production is developed by me, Olaf Gleba. The grafic design is supplied by C&G: Strategische Kommunikation GmbH. Homepage: https://www.wuppermann.com Some Impressions: (Secured) Shareholder portal, only available in german language Former screens deleted on behalf of the client. Technical notes: 1. All contents are populated by provided (i name them) content modules (e.g. Repeater Matrix Types) which gets the client what he needs and either prevent him from doing weird stuff. In nearly all textareas formatting is limited to a absolute minimum. For example, image insertion in CKEditor is generally prohibited. Instead there are dedicated fields for modules which holds media content. 2. This and that.. - vCards are build on the fly with a admin hook on page save. - PrivacyWire as CCM (just a few cookies to handle Matomo and external movie content) - Uses the SearchEngine Module to handle (multilanguage) site search - Email Obfuscation Module for frontend e-mail addresses - Wire Mail Smtp to deliver automated e-mails - Multilingual (currently german, english). Hungerian, polish, dutch following. - Ajax driven content (for example on the contact page) - Heavy use of Fieldtype AssistedURL (Fork by @adrian) to provide language dependend, local file linking (fieldname_[de|en] approach) - Login area (shareholder portal) with secured file downloads ($config->pagefileSecure = true) - Email New User, Admin Action (create users batcher), Force Password Change for functionality like adding new users with specific roles, Password reset, Change Passwort a.s.o. - Distribution of concatenate/minified css and javascript is cachebusted (happens within my developement environment,- no modules (like AIOM etc.) involved). - Thanks to @ryan* all images are delivered in WEBP format (with fallback). *) s. https://github.com/processwire/processwire-issues/issues/1497 - The site uses a bunch of modules provided by the ProFields Package (for example the Combo, Repeater Matrix and Table Fieldtypes).
  7. Hi @bernhard, just being curious ;-). My current dev environment (i am afraid the github version is not quite up-to-date 🙄) for PW projects is based on Gulp as task runner, the PHP internal server and (beside many other things) Browser Sync ( https://browsersync.io/ ) for live injection or reloading (depending on file type) on several devices. Works fine. The problem you describe above never occured to me. As i follow your posts here in the forum quit frequently, i guess you are familiar with different approaches for dev environments. I, for example, never used webpack so far. But i am always keep my eyes(and mind) open... In your point of view,- are there some outstanding pros using webpack (and his eco system)? I know, not very precise, but just wanted to take the chance...
  8. Thank you @ryan for clarifying this (i am sure this is explained somehere in the docs already, sorry...). I only have one $config->httpHosts array, e.g. multiple hosts. What i haven't considered: www.foo.bar is not the same as foo.bar. As i only defined foo.bar so far, but the site points to www.foo.bar, PW grabs the first array entry. Which is/was Probably i missed that, because on all my other sites i tend to point everything to foo.bar, as i find it a bit strange to prefix regular addresses with the subdomain www for no technical reason.
  9. Hi, i hardly dare to ask (because surely i miss something obviously and it sounds a bit silly)... I transfer the local installation to the live environment. Frontend works fine, all admin links/buttons (like edit, settings tab etc.pp) also (e.g. prepends the live host root correctly). Except the view button (either in the page list or while in page edit mode) references to the/a localhost root instead of the real live host. Instead of https://www.host.tld/<path-to-page>/ i get<path-to-page>/ when hovering over the "view" button/link. This is confusing. Can't remember that i have to tweak anything in former projects. Just to confirm the database is sober, i queried the database,- there are no results for So possibly is has something to do with the config or/and htaccess(?). But i can't find any false or missing input here, too. At least in comparison to many former projects on different hosts. Setup: PW 3.0.200, mysql 5.6, PHP 7.2.23 (stable) Any hints? Thx in advance.
  10. @Nick Belane Hi, fixed it but haven't found the origin of the issue. I just downloaded the latest PW (3.0.184 by the time) and replaced the wire directory, index.php and htaccess by hand. But as the current master meanwhile is 3.0.200, try to repeat the upgrade steps. Maybe there is no issue with this particular upgrade. Even though, you should be save to replace the mentioned dirs/files by hand (Nonetheless i recommend backing up all relevant folders).
  11. @teppo I completely agree. Thank you for your important addition. In situations where the search section is not a essential part of the UX of a site/project (with only low budget for this part), it is possibly o.k. to use just one approach. Still combining client- and server validation is to prefer in most cases.
  12. @bernhard Brilliant stuff, thx. I have to dig into Tracy soon (installed, but yet not fully explored).
  13. @Jan Romero Many thx for your reply. The missing d made the difference ;-). With Pages::saved all works fine. Either with After or Before.
  14. Hi, a question of a hook newbie... Probably a simple one, but nonetheless i don't get it after reading the docs and playing around. While in admin i do something with some page fields before saving a page (here: generating vcards). If the page already exists (e.g. edit the page), its straight forward: $wire->addHookBefore('Pages::saveReady', function($event){ $page = $event->arguments(0); // do something with some $page fields... }); But i forgot to handle the case when a page is added. This naturally this leads to a ProcessPageAdd: New page '/path/to/page' must be saved before files can be accessed from it For my understanding, i somehow must differ between Pages::added and Pages::save (or Pages::saveReady) and/or combine the two respectively. Anyway, i assume this may not quite right, so i am running out of ideas. Maybe someone could give me some advice how this should be done. Thx in advance!
  15. Hi, haven't seen this before: Upgrading a 3.0.98 installation breaks after second step (database backup, skip backup), s. screen below. State: Master is downloaded, Database backup done, folders are created. Modul Upgrades => last current version (1.1), cleared all possible caches twice. Any ideas? Thx in advance.
  16. Just as an addition to my post above. Maybe someone benefits from it... In a multilanguage environment the HTML5 validation prevents controll over the output on search input errors (example: when the search string is too short). It skips translated strings and always gets populated depending on the browser language settings. To disable the HTML5 validation, you must enhance the template render args for the form with the attribute novalidate. $config->SearchEngine = [ 'render_args' => [ 'templates' => [ 'form' => '<form id="{form_id}" class="{classes.form}" action="{form_action}" role="search" novalidate>%s</form>', ], ], ] With that, errors are displayed within the regular HTML Elements (which respects translated strings). I don't see any drawbacks so far. See also the comment from @teppo below!
  17. @horst @howdytom Hi, same here. I empty the variants list. Original formats gets deleted, webp files remains in the asset folder. In my case, wether the image field is placed in a RepeaterMatrix (v5, latest) or is a single PW Field. It makes no difference. This is a big drawback. In my current project there were a buch of files corrupted on creation (webp). Which causes strange behaviour in google chrome. Inspected this a couple of hours,- until i found out the webp files won't get deleted physically form the asset folder. And so never being recreated. Deleting them manually solves the problem. But iterating through all assets folders by hand i cannot afford. Get rid off them with a script seems the way to go... While debugging i tried out all possible execution markup and calls as i assumed somethings wrong with my integration/code. But this was not the case. All scenarios (s. below) works fine since it turned out the only problem were the remaining webp files. PW 3.0.192 dev, GD lib image sizer Engine. @horst If there is anything i can do to help further exploring the behaviour, please let me know. Excerpt: With $config->useWebP = true; , lazysizes <?php $options = array( 'upscale' => false, 'cropping' => 'center' ); $page_image_palm = $page->image_head->size(480, 640, $options); ?> <picture> <source class="" media="(max-width: 480px)" data-srcset="<?= $page_image_palm->url; ?>" alt=""> //... <img class=" lazyload" data-srcset="<?= $page_image_palm->url; ?>" alt=""> </picture> Excerpt: With $config->useWebP = false; / Markup with default API call like in https://processwire.com/blog/posts/webp-images-on-an-existing-site/ <picture> <source class="" srcset="<?= $page_image_palm->webp->url; ?>" type="image/webp"> <img class="" src="<?= $page_image_palm->url; ?>" alt=""> </picture> And some other calls in between...
  18. @horst Your assumptions were all right. Argh, it happened quite more than once that i simply forgot about that. Thank you very much for your brief and clear explanation. @bernhard @Robin S Big thanks also for your advice and details.
  19. Hi, depending on the status of a set checkbox (set_create_vcard) i generate VCF files on page save (admin). For this i have a hook (s. below) placed in admin.php. Everything behaves like it should. But when i try to integrate a image in the vcard i get the following message/error on page save (Returned data is not a image comes from the exception class of the VCard lib). ProcessPageEdit: Returned data is not an image. I am asking this question here in the PW Forum (and not on the github board of the lib), because integrating the (essentially) similiar code in a regular template file (e.g. outside the hook) works flawlessly (with the same images accepted, e.g do not trigger any error). I am rather a newbie when it comes to hooks. So its likely that i miss something. Any hints much appreciated, Olaf <?php // file: admin.php // get vcard lib (composer module) on top use JeroenDesloovere\VCard\VCard; /** * Admin template just loads the admin application controller, * and admin is just an application built on top of ProcessWire. * * This demonstrates how you can use ProcessWire as a front-end * to another application. * * Feel free to hook admin-specific functionality from this file, * but remember to leave the require() statement below at the end. * */ $wire->addHookBefore('Pages::saveReady', function($event){ $page = $event->arguments(0); if($page->hasField("set_create_vcard")) { if($page->set_create_vcard == 1) { $page->set_create_vcard = 0; // define vcard $vcard = new VCard(); // define variables $fullname = $page->combo_contact->name; // add personal data $vcard->addName($fullname); /* ... some other allocations ... */ // WHERE IT BREAKS... if($page->image_contact) { $vcard->addPhoto($page->image_contact->filename); } $vcard->setSavePath($this->wire('config')->paths->root.'process/public/vcard'); $vcard->save(); $this->message('VCF Datei für den Kontakt wurde erstellt'); } } }); // Do not touch... require($config->paths->adminTemplates . 'controller.php');
  20. Hi @Zeka, many thanks for your hint! Helped me to get going. My first guess was right,- missed something obvious 😏. Too avoid the mistake i made, this might help other forum members eventually: As long as an file (which is used by a javascript ajax call) is not accessible to the processwire core (e.g. is a dedicated page derived from a template at least), such things as core translation etc. are not available in those files. My approach here was to create a template, create a page from this template (with the code of my former `contacts-flatproducts.php`, s. OP) and took this page as my reference within the form action attribute.
  21. Hi, here is a task thats new to me. And obviously i overlook some basics. So maybe someone is so kind to give me some advice on this... I have a page whichs collects some contact boxes straight away on page load. It is a multilanguage Site (default is in German, the screenshots shows the english version). The results are wrapped in a form, because the user is able to narrow the resulting contacts by a page reference language switcher (values are part of every contact entry)*. This is done with a javascript ajax request to avoid page reloads. TL;DR: While everything is fine on page load, as soon as i select a country to get the related contact boxes by a ajax call, the static translated strings within the target PHP file are not recognized, e.g. their translation fails. I assume i simply miss some basics here what and when things get parsed when doing such asynchron call. *) The language switcher values has nothing to do with the choosen user language. And for the brave ones... On Page load: The highlighted areas are static translated strings (s. below). All is fine on page load (whatever current user language). If the user selects a country within the language switcher, the form in submitted per JS, do a ajax call and query the results by the giving value of the select option (more details s. below). The result is valid and looks like this (here i narrowed the result to contacts related to germany): BUT: As you can see, the static translation strings (s. highlighted areas) are not translated (e.g. use the default site language). To give a brief overview how its done, here some excerpt screens. Form tag with action target: Javascript: And here is the processing target PHP file (excerpt): contacts-flatproducts.php Many thanks in advance, Olaf
  22. Meanwhile i found the way to deal with my approach for translations. Possibly it helps others, so i post it here. Tl;dr: I have a function to enable translation of static template strings. This allows me to reference a _strings.php file as site translation file in the PW Backend. To apply this to the SearchEngine Module, you have to edit some configuration settings before rendering. $searchEngine = $modules->get('SearchEngine'); $config->SearchEngine = [ 'render_args' => [ 'strings' => [ 'form_label' => _t('Suche', 'search'), 'form_input_placeholder' => _t('Ihr Suchbegriff...', 'search'), 'form_submit' => _t('Suche', 'search'), 'results_heading' => _t('Suchergebnisse', 'search'), 'results_summary_one' => _t('Ein Ergebnis für "%s":', 'search'), 'results_summary_many' => _t('%2$d Ergebnisse für "%1$s":', 'search'), 'results_summary_none' => _t('Keine Ergebnisse für "%s".', 'search'), 'errors_heading' => _t('Hm, ihre Suchanfrage konnte nicht ausgeführt werden', 'search'), 'error_query_missing' => _t('Bitte tragen Sie einen Suchbegriff in das Eingabefeld ein', 'search'), 'error_query_too_short' => _t('Bitte verwenden sie mindestens %d Zeichen für den Suchbegriff.', 'search'), ] ] ] <?= $searchEngine->renderForm(); ?> <?= $searchEngine->renderResults(); ?> === Approach to translate: _func.php /** * This function enables the translation of static template strings. * All translations are done in `_strings.php`. More info within the * comments of `_strings.php`. * * @param string $text text to translate * @param string $context Context to allow doubles * @param string $textdomain Point static textdomain * @return function Function for gettext parser */ function _t($text, $context = 'Generic', $textdomain = '/site/templates/_strings.php') { return _x($text, $context, $textdomain); } _strings.php /** * Static translated template strings to use project wide * in any templates. This spares us defining page fields * for every piece of code that doesn't have to be editable * within the admin interface. The function doesn't need to * execute with PHP, so we wrap it in a comment leaving * the code only visible to the language parser. * * Relies on function `_t` (s. `_func.php`) * * Usage: * 1. Define string in markup, e.g. "_t('<string>', '<context>')" * 2. Insert string in `_strings.php`, e.g. "_x('<string>', '<context>')"; * both without the surrounding double quotes. This is just to avoid * this comment is parsed. * 3. Choose the language you like to translate the default language strings * 4. Under (possibly still empty) "Site Translation Files" click on "Translate File" to get * a list of translatable files. Choose the `_strings.php` and click send/save. You'll * see the translatable string phrases. */ /*! _x('Suche', 'search') _x('Ihr Suchbegriff...', 'search') _x('Suchergebnisse', 'search') _x('Ein Ergebnis für "%s":', 'search') _x('%2$d Ergebnisse für "%1$s":', 'search') _x('Keine Ergebnisse für "%s".', 'search') _x('Bitte tragen Sie einen Suchbegriff in das Eingabefeld ein.', 'search') _x('Bitte verwenden sie mindestens %d Zeichen für den Suchbegriff.', 'search') */
  23. First, teppo, thanks a lot for this module! It is really a great timesaver. SearchEngine v. 0.30.5, PW 3.0.192 dev. I struggle a bit with text translation feature (Labels, Placeholder a.s.o.). As i need to translate those text in several languages, initializing SearchEngine with $user->$language conditions statically is rather not an option. I see the getDefaultStrings() function, but have no clue how to benefit from it. Maybe i overlook some docs. It would be very kind, if you or someone else could give me a brief overview how to set this up. Currently i simply render SE straight out of the box (with some $config->SearchEngine = [...] tweaks before it). Many thanks in advance, Olaf
  24. Thx @BillH I did that shortly after i sent my post. And there it was,- each of both related entries had a single whitespace before the string. Solved. Sorry for not posting this more in time.
  • Create New...