Jump to content

psy

Members
  • Posts

    637
  • Joined

  • Last visited

  • Days Won

    8

psy last won the day on June 10

psy had the most liked content!

3 Followers

Contact Methods

  • Website URL
    http://www.clipmagic.com.au

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

8,697 profile views

psy's Achievements

Hero Member

Hero Member (6/6)

943

Reputation

  1. Using v1.0.14 which fixes a problem for multi-language sites. Unfortunately it breaks single language sites as it assumes multi-language support is installed. Fix for me was: public function ___wakeupValue(Page $page, Field $field, $value) { $field = $field->getContext($page); $this->svg = $field->get("format") !== "gif"; $this->markup = $field->get("markup") === 1; $user = $this->user; $languages = null; if(wire('modules')->isInstalled("LanguagesSupport")) $languages = $user->isGuest() ? [$user->language] : $page->getLanguages(); $sources = $this->parseSources($page, $field); return $this->generateQRCodes($page, $sources, $languages);
  2. Installed RockFrontend for the first time on a client dev site. Great work @bernhard! Client (superuser) is happy with the ability to modify content on the fly from the frontend. Had a few issues however with FormBuilder conflicts. When I render a FormBuilder form on page via the api, and manually add its styles and scripts in the <head> tag, RFE js fails with RockFrondEnd not found. Worked around this by embedding the form via the api so no js conflicts How do I turn off LiveReload for a guest user? Another form is in a 'body' field that is ALFRED enabled, with FormBuilder Method A, see attached image. The LiveReload code still loads and screws the FormBuilder CSRF check even though the user is not logged in. Work around was to turn off CSRF Check on the form but would prefer to have it enabled. Using: PW: 3.0.237 RockFrontEnd: 3.18.2 FormBuilder: 0.5.5
  3. No question, ProcessWire is fabulous for developers and the suggestions above would make it even better. Customers who are not developers are increasingly giving me feedback about how unintuitive the backend admin/editor is, especially now with the proliferation of DIY pagebuilders. Clients don't understand or care about the consequences. They care about not having to learn code to easily update their sites. They want the backend to look similar to the frontend, the convenience of doing it themselves without having to pay a developer. Too bad if the site doesn't work on all screen sizes, light/dark modes, isn't accessible, the home page looks like a ransom note, whatever. They genuinely don't like the default PW admin UI/UX. Pagegrid and RockPageBuilder modules are leading the way to solve this issue. Kudos to both developers BUT the modules are premium while a WP site gives customers basic WYSIWG page editing out of the box. My vote is to overhaul the admin UI/UX to make editing pages more WYSIWIG.
  4. Agree with @BrendonKoz. A vertical list on mobile is boring and no one scrolls on a carousel. The thing that has worked best for me is to shuffle the list. This has several benefits: No sponsor can complain their logo isn't visible - all have an equal opportunity Page content is constantly fresh which keeps the search engines happy Maybe on mobile have a small number of random logos on the home page/footer and a button linking to a sponsor list page. Have clients take this one step further and give each sponsor a dedicated page after clicking on their logo. Again this has worked well for SEO especially when the sponsor shared their page on their socials.
  5. Here is a CSS-only solution to this exact problem from Kevin Powell:
  6. [solved] And so it happened again but this time it was same but different. Two weeks ago, all worked perfectly according to the LRP recipes. Today the fe user wouldn't log in??? I could login to the protected pages as superuser. Checked all the advice given in above and other posts. I had not changed anything on the site and nothing recorded in the logs, Tracy Debugger etc. The only hint was in the Chrome browser dev tools that the LoginRegisterPro init() function wasn't loaded. I'm using MarkupRegions and on the latest versions of PW and LRP and PHP 8.1 My bad, I had in my template code: <region id="regHeadCSS" pw-append> <?php $loginRegister->renderStyles() ?> <?php $loginRegister->renderScripts() ?> </region> Should have been: <region id="regHeadCSS" pw-append> <?= $loginRegister->renderStyles() ?> <?= $loginRegister->renderScripts() ?> </region> OR: <region id="regHeadCSS" pw-append> <?php echo $loginRegister->renderStyles() ?> <?php echo $loginRegister->renderScripts() ?> </region> Still don't understand why it worked originally but all's well that ends well
  7. Try in your template: <?php // assuming 'matrix' is the name of your repeater matrix field if($page->hasField('matrix') && $page->matrix->count > 0) : echo $page->render('matrix'); else: echo $page->body; endif; ?>
  8. I'm familiar with $files->render and use it reguarly to include snippets in templates, passing PW vars to the snippet file. Came across a head-scratcher today. In my included snippet, I pass a PW WireArray as a var. I tried lots of variations in various browsers, all with the same result: When logged in as admin and viewing page, everything displays correctly When not logged in, ie guest user, only the included snippet HTML wrapper displayed on the frontend, not the output logic generated within the snippet The page has no viewing restrictions and the file permissions on the server all look good. Using: ProcessWire 3.0.234 PHP 8.1 Suggestions on how to fix or pointers to the documentation I may have missed, welcome. TIA psy Solution: The $files->render call was a red herring. The problem arose with my $pages->find selector. The requested page template is quite complex with a page reference field within a repeater and the parent page hidden from lists and searches. Seems PW struggled with all the complexities involving the repeater field filtering on a page reference field, especially when the page's parent was hidden, and user permissions. In one variation, the selector returned all the correct page ids as a string, despite not specifying same in the selector. Finally got it to work by making life easier for PW, ie: <?php $currency = 'USD'; $things = $pages->find("template=thing, page_thing_type.id=1040"); // get all the published pages with a template of 'thing' and page reference field id of 1040 $things->filter("rptr_currency_and_msrp.page_currency.title=$currency" ); // reduce the PageArray based on the repeater field's page reference field's title $thingItems = $page->getMythings($things, $currency); // do stuff with the filtered PageArray in a page class $files->render('inc/my_things',['lines' => $thingItems]);?> Now all displaying correctly for guest users and tested in multiple browsers.
  9. ChatGPT found MutationObserver and helped me solve a similar issue, ie modifying ajax-loaded page content on a 3rd party SaaS platform ?
  10. I developed at multi-lang site in Australia with the default lang as English UK. One of the other lang choices was English US. It all worked perfectly until the live site was moved to a US host. Now the lang switcher (as per documentation) gets confused between the two. It appears to default to English UK but in reality is defaulting to English US. When using the lang switcher, it even gets the lang names & flags mixed up. It's also breaking some javascript. When the js tries to identify the English US lang via the URL, it simply cannot with the WireException "Unknown language". I've tried changing the SET_LOCAL and HTML to en_us with no effect. Other langs on the site work perfectly. Any and all suggestions on how to fix most welcome Solution: There were 3 things causing problems: 1. Typo from me in the default language title field. ?‍♀️ This resulted in the wrong language name displaying in the language switcher 2. My language names for English US and English UK did not match the name values in @Sebi fab AppApiPage.module resulting in "Language not found" for en-us. English UK being the default wasn't affected. Changed them to match, ie: $languageCodes = [ // 'en-gb' => 'english-united-kingdom', 'en-gb' => 'english-uk', // 'en-us' => 'english-united States', 'en-us' => 'english-us', ] 3. In @Wanze great SeoMaestro module, line 157 of the PageFieldValue.php class assumes that the language names are the language codes, eg en-us instead of English US resulting in incorrect alternate hreflang meta tags. I changed it to: // $code = $language->isDefault() ? $defaultLang : $language->name; $code = $language->isDefault() ? $defaultLang : $this->wire('pages')->get(1)->getLanguageValue($language, 'name');
  11. Thank you all. Great advice as always. ? Obviously didn't explain my scenario clearly. I have a page template that includes an inline <script> that uses js fetch to connect to the AppApi module. Works great. The authorisation token is hardcoded to the AppApi token for dev purposes. Not good for real world. The site doesn't use VITE or Heroku or other platforms. It's plain old JS. I would like to: Change the inline script to a js file called in the template Hide the AppApi PHP session token from the browser output <?php ?> <script> const MyApiCall = async (url) => { let connect = await fetch(url, { method: 'GET', credentials: 'same-origin', mode: 'same-origin', headers: { 'x-api-key': 'is3434343axxxxp3662OB', } }) let result = await connect.json() return result } </script> I'm investigating https://www.npmjs.com/package/dotenv-webpack and struggling. @Sebi are you able to help? While my case includes AppApi, am sure others must have similar issues connecting PW via JS to endpoints that require (secure) authorisation in the http header. Cheers @psy
  12. I've built a PW web app that integrates as a plugin to a SaaS app and it's working really well though I have a bit of final bug-ironing to do. One thing I've avoided addressing is implementing node dotenv. There is a javascript api method that calls on the PW AppApi module. It needs the AppApi token. The call is behind numerous logins, permission checks etc. However, for safety's sake, I would like the token to not be visible in the page source. Have any of you implemented node modules in PW? How did you do it and where did you put the .env file? Is there an alternative to node to achieve the same result? I've created a custom module to do many of the functions - should I put reference to node in the module's composer.json? Thanks in advance Cheers psy
×
×
  • Create New...