Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by psy

  1. Hi @Sebi Would you please give some actual code examples? I've tried all sorts of variations and if I manage to get a response, it's always in the default lang (English), eg: Thanks for all the work you've done with AppApi and the add-on modules. Hope you can help. Cheers psy SOLVED (almost!) In _init.php: In my page template javascript: In my AppApi custom class to make it multi-language: Everything seems to work fine EXCEPT when using AppApiPage on the home page. The response is still always in the default language.
  2. Tip for the unwary... My admin site's default lang is 'en' - just happens as per install. Was surprised to see that the new TinyMCE inputfield menus etc defaulted to Russian 🤔. Solution: When configuring Modules -> InputfieldTinyMCE, ensure your 'default' lang is set to the correct lang code, eg "en-US"
  3. @DV-JF it was running 3.0.200 and I upgraded to the latest dev 3.0.207 I also changed line 845 in PagesLoader.php to confirm if $options is an array: $options = is_array($options) && count($options) ? array_merge($defaults, $options) : $defaults; Switched the site back to PHP8 and it's working again. @ryan fyi
  4. It worked before and now not 🤔 The web server was recently upgraded to PHP8 and I know PHP8 is much stricter on argument typing than previous PHP versions, and this blip resulted in a Server 500 error: 2022-11-16 14:56:21 guest https://xxxxxxx.com/api/ Fatal Error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /home/xxxxxxx/public_html/wire/core/PagesLoader.php:845 The code was a 'page get' selector request in an ajax call. It all worked before the PHP update and I'm sure there are others using $pages->get() without issues on PHP8. $pages->get("id=". $sanitizer->int($data->pid)) I also tried it without the "id=". I think the problem is more that $options is a string in the line in the PagesLoader.php: <?php $options = count($options) ? array_merge($defaults, $options) : $defaults; Any ideas on how to fix? Thanks, psy Solution Changed line 845 in PagesLoader.php to confirm $options is an array and the site worked again. $options = is_array($options) && count($options) ? array_merge($defaults, $options) : $defaults;
  5. On many of my sites I have a page for business information which includes: toggle for site down for maintenance or live combo field for business name, address, phone, email, contact name, etc functional field for common phrases The combo field is great in this scenario. The data is fairly static and I only need to add the one combo field for a bunch of 'sub' information, bits of which may be used throughout the site. The alternative is to create a fieldset with individual fields, all of which would only be used in a single template and have one entry per field.
  6. Hi @Jan Romero The PW docs refer to language codes. I didn't realise language codes and country codes were slightly different. Solution discovered by trial and error, and ironically, Google's Search help. Initially the warning only appeared when that lang page loaded, but once done so, the whole site had "Dangerous" in the browser address bar. Refreshing using the default lang cleared the message.
  7. This is my first multi-lang site and client, bless his cotton socks, has chosen to have the site in at least 10 languages. Have figured out many things but Chrome is not playing nice. The default lang is English UK (lang url code is 'default' or 'gb'). On some langs, esp English US (lang url code is 'en-us') and Japanese (lang url code 'jp'), it's flagging the pages as "dangerous - could be phishing". All works fine in Firefox. Questions: 1. How to stop Google flagging valid lang pages as dangerous? ANSWER: Use the language code NOT the country code in the URL, eg English US = en-us (not just 'us') and Japanese = ja (not 'jp'). 2. On langs that don't follow the 'English' convention of text LTR, how do I set alternatives in the HMTL? eg Japanese is 'top to bottom, right to left'. Have done what I can in the CSS using logical properties (eg margin-block-start, padding-inline-end, etc) ANSWER: Add the language name as a class in the body tag then set the writing mode in CSS, eg: /* japanese */ body.japanese { writing-mode: vertical-rl; min-height: auto; overflow-x: auto; } HTH psy
  8. Being able to download full-scale images, including SVG's, directly from an admin->page-edit->images field via a single click on an icon would be a great feature
  9. Not sure I fully understood thei issue but I'd use dev tools to identify the element rule, then add the download icon to :before or :after styling in your custom CSS after SCSS compilation
  10. So, after 5+ years of being a ProcessWire dev, I've bagged my first multi-lang project. Be prepared for questions 🤣
  11. @BrendonKoz Container queries have been on the CSS agenda for a long time. At present the @container rule has limited browser support but it's definitely on its way. See https://caniuse.com/?search=%40container
  12. @maddmac glad the module still works ? It doesn't do anything except create new pages as per the criteria set in the module config. The new pages are simply pages - you can then query whatever you wish as normal. The module only has one method which adds a Hook Event after a page is saved.
  13. Seems to be a problem with namespaces. Try adding namespace ProcessWire to the template: <?php namespace ProcessWire; include '<?php echo $config->urls->templates ?>stripe-php/init.php'; //require 'vendor/autoload.php'; use Stripe\Stripe; Stripe\Stripe::setApiKey('xxxxxxxxx');
  14. Just a thought... maybe change it to findJoin and add the task.tast_status field to ensure it's included in the query? https://processwire.com/api/ref/pages/find-join/
  15. @millipedia So with you on that! Took time to actually learn CSS, and while it's constantly changing, decided to to lose the "Sara Lee" approach - layer upon layer upon layer. Spent far too much time overriding framework defaults instead of actually doing stuff. Now I use SCSS to combine global resets, default classes, colours etc then add small per template or component stylesheets. Same for any per template JS. In the supply-chain world this is referred to as "just in time" vs "just in case"
  16. ? @cb2004 Needed the exact same thing recently and read through the docs, trial & error and came up with the same solution. Should have known to search the forum
  17. Apologies if this has been answered before. Great module and too many questions/anwsers TLDR... While I love that 'levels' is available, it applies only to <li> elements. I've created a multi-level CSS Only menu that's responsive for both for 'touch' and 'hover' devices. The nightmare was CSS specificity. CSS doesn't cater for 'parent' - it's in the name! How can I add a 'level' class to <ul> elements in the options or via a hook?
  18. @opalepatrick not in my experience. One thing to check is to ensure you have the ampersand at the front of @file_get_contents to ensure it's by reference.
  19. @bernhard Normally I use MarkupSimpleNavigation and cache each 'page' menu with the appropriate 'active' class set. This menu is so small I decided only to cache the PageArray then output to the front end using a foreach loop and test to see if the page was 'active' and add the CSS class accordingly in the template. Wanted to bring it to attention in case it's a 'gotcha' for others working with custom page classes and cache. ?
  20. Loving the custom page classes but I ran into an issue. I wanted to cache the main navigation items to save DB calls. Set up is: site/classes/HomePage.php site/classes/BasicPagePage.php and templates: basic-page.php home.php In _init.php: <?php namespace ProcessWire; // Get the nav items and save them to a cache /* This crashes with Error message: User Error Exception: Can't cache multiple page types together: HomePage, BasicPagePage (in /home/xxxxx/xxxxxx/wire/core/WireCache.php line 954) */ $menuItems = $cache->get('menuItems', 3600, function() { $pp = wire('pages'); $items = $pp->find("id=1|1028|1031|1029"); // Home, Gallery, Testimonials, Contact return $items; }); bd($menuItems); // Without saving to cache works fine $items = $pages->find("id=1|1028|1031|1029"); // Home, Gallery, Testimonials, Contact bd($items);
  21. @Warran Yes, yes and yes As in my original post, both the page & repeater matrix field use the 'body' field. It's a textarea with CKEditor + TextformatterVideoEmbed and the body content source code is the same
  22. Having strange issues with this one as well. The field is 'body' and it has the TextformatterVideoEmbed option. On the same page, I have the YT URL in the page's body field. It outputs the URL. Below it, I have a Repeater Matrix field with the same body field and content and it outputs the video. Any ideas? Edit: I have found a cause but not the fix. My code is: <?php $featured = false; if ($page->hasField('images') && $page->images->count > 0) { $featured = $page->images->last; $description = !empty($featured->description) ? $featured->description : $page->get("headline|title"); } // ... ?> <?php if (!empty($page->body)) : ?> <div class="main__body owllob"> <?php if ($featured != false) : ?> <img class="main__feature-img" loading="lazy" src="<?=$featured->width(300)->webp()->url?>" alt="<?=$description?>" /> <?php endif; ?> <?=$page->body?> </div> <?php endif; ?> When I include a 'featured' image and even though it renders separately to the body field, the YT URL does not convert. When I delete the image, it does and the video shows/plays as expected???
  23. Quick update... Finally figured out to get React/NextJS to work with a basic (minimal field types to convert to JSON) PW site. Giving self a pat on the back when I discovered Svelte ? Svelte felt (I'm a poet & didn't know it ?) so much more like PW - JS, HTML & CSS with 'state management' and no shadow DOM. The only problem was routing. I'd spent far too long figuring out React/NextJS routing and Svelte offered no immediate solution. The old (like 2yrs) way of routing was called Sapper. Development on Sapper has ceased with all efforts now focussed on the new way, SvelteKit which is in pre-beta (? ). Anyhoo, went with SvelteKit and got it working. I've only scratched the surface on what's possible with React/NextJS and Svelte. Both offer Server Side Rendering (SSR) making the site SEO friendly & fast-loading. Given a choice, I'd choose Svelte every time. With both React/NextJS and Svelte using @Sebi's AppApi with customisation depending on the framework, I: created a home page that pulls the data from the PW home page created a 'slug' page that pulls the data from the PW page url and displays it in a component based on the PW page template as returned in the page JSON, and shows the correct route in the URL from a nav menu In both cases, the page layout is not a PW template but a conditional component file. Anyone else tried Svelte with PW? Your thoughts & comments welcome
  24. I'm running 3.0.175 on a dev site and all works as expected for editing admin templates & fields. Have you tried reverting to the PW default UiKit admin theme? Maybe something to do with the custom admin theme you're using
  25. Thanks for the suggestions. Putting it down to a 'who knows?' Nothing changed and all small images that failed yesterday uploaded fine today. That's net-life for you! LOL
  • Create New...