-
Posts
339 -
Joined
-
Last visited
Everything posted by Tyssen
-
Module that forces changes to page title to update page name field
Tyssen replied to Tyssen's topic in Modules/Plugins
Not necessarily. Page title might be terms and conditions, but you don't really want the page name being /terms-and-conditions/ -
Module that forces changes to page title to update page name field
Tyssen replied to Tyssen's topic in Modules/Plugins
Yes, that was it, thanks. I'm not totally familiar with how the site is put together yet, but I think the issue may be that there are hard-coded links to some pages in templates. -
I've inherited a PW site that has something installed which forces changes to the page title field to update the page name field under the settings tab too, and vice versa. The site does have the Connect Page Fields installed but title and name aren't set as connected fields. It also has Custom Inputfield Dependencies installed but that doesn't look like it would do this. Anyone have any other ideas what might be causing it? Because I'd like to turn it off.
-
When changing PHP from 7.4 to 8.0 I get this error pointing to line 1155 of TraceyDebugger.module.php: if(in_array('titlePrefix', $this->data['styleAdminType'])) Opening the call stack says that $haystack = 'default'. I'm running PW 3.0.210 with Tracy 4.24.3. Not sure whether this is a problem with the module itself or something else in the site.
-
Thanks @flydev I've tried your code and get a 500 error which I really don't understand. Since posting this, I found https://reqbin.com/curl and when I test my API URL, it works fine and I can see the same output as if I visit the URL directly in a browser. That site gives you the option to generate code in different languages. The PHP code it generates is essentially what I already have. If I use the js/AJAX code it suggests, I can see the response printed in the console. 🤔
-
Although not strictly a Processwire question, I am trying to do this on a PW site, so… I have the following code: $url = 'https://json-api-url-domain.com/matches?id=XX&division=YY&teams=[ZZ]'; $cURL = curl_init(); curl_setopt($cURL, CURLOPT_URL, $url); curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true); curl_setopt($cURL, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Accept: application/json' )); $result = curl_exec($cURL); curl_close($cURL); $json = json_decode($result, true); var_dump($json); But with that I'm getting: array (size=2) 'name' => string 'TypeError' (length=9) 'message' => string 'Cannot read properties of undefined (reading 'includes')' (length=56) I get the same message if I var_dump $result. I can visit the API URL directly in a web browser and see the JSON response. Any idea why that is and how do I fix it?
-
Getting index from page images array in for loop doesn't work
Tyssen replied to Tyssen's topic in API & Templates
Excellent, thanks! 👍 -
I'm trying to do this: $img_w_0 = 312; $img_w_1 = 485; $img_w_2 = 380; foreach ($page->images as $i=>$image): $contentImages .= 'Width = '. ${'img_w_'.$i}; which produces Width = Width = Width = and no value. If I instead do this: $images = array( '0.jpg', '1.jpg', '2.jpg' ); foreach ($images as $i=>$image): then I get the correct values printed out, i.e. Width = 312, Width = 485, Width = 380. Why does the index not work for the page images array?
-
This is how I did it: $mb = $modules->get('MarkupMenuBuilder'); $items = $mb->getMenuItems('Main', 2); foreach ($items as $item) : if ($item->isCurrent) : $currentID = $item->id; $parentID = $item->parentID; endif; endforeach; $subItems = $items->find("parentID=$parentID"); foreach ($subItems as $subItem) $output .= '<a href="'.$subItem->url.'">'.$subItem->title.'</a>';
-
processwire.dev — Tutorials for web development with ProcessWire
Tyssen replied to MoritzLost's topic in Tutorials
Actually, ignore me again, it's there on production. -
processwire.dev — Tutorials for web development with ProcessWire
Tyssen replied to MoritzLost's topic in Tutorials
I haven't checked pages with output that the others use, but one page that uses the Srcset Image Textformatter should take something like <img src="image.jpg"> in a CKEditor field and transform it to: <img src="image.jpg" srcset="image_320.jpg 320w, image_480.jpg 480w"> based on settings you enter into the module for the size variants. The output is just the normal non-srcset version of the image. -
processwire.dev — Tutorials for web development with ProcessWire
Tyssen replied to MoritzLost's topic in Tutorials
I have some text formatters applied to CKEditor fields – Profields Auto Links, YouTube video embed, and Srcset Image Textformatter. The modified output's not working with the Twig set up. Is there something else other than setting autoescape to false that needs to be added to done? -
If you've created a menu like this: Parent 1 - Child 1.1 - Child 1.2 Parent 2 - Child 2.1 - Child 2.2 and you're on page Child 1.1, is there a way to just get the siblings of the submenu, i.e. Child 1.1, Child 1.2? And every time you change to a page under a different parent, it shows only the child menu items?
-
processwire.dev — Tutorials for web development with ProcessWire
Tyssen replied to MoritzLost's topic in Tutorials
Yep, row.get('field_name') worked. ? -
processwire.dev — Tutorials for web development with ProcessWire
Tyssen replied to MoritzLost's topic in Tutorials
Ignore me, I'm an idiot. I had caching turned on for the template I was testing. ? I have come across another problem though. I have a ProFields table field with a text and two checkbox fields. I'm looping through the rows like this: <tr> <th scope="row">{{ row.field_field }}</th> <td> {{ row.field_match }} </td> <td> {{ row.field_training }} </td> </tr> field_field renders OK, but with the checkbox fields in the template, I get "field_training|match does not exist or is not callable in this context". But if I add {{ page.field_status.first.field_training }} outside my loop, I get the correct output. -
Viewing a front-end page in responsive mode logs you out
Tyssen replied to Tyssen's topic in General Support
Ah, I guess because responsive mode sends a different user agent. TBH, it's a config setting I'm not sure I've ever actually stopped and read properly. But good to know how to fix it. ? -
processwire.dev — Tutorials for web development with ProcessWire
Tyssen replied to MoritzLost's topic in Tutorials
Hi Moritz, I was following your Using Twig with ProcessWire article today to set up a site for using Twig and have come across a strange problem. When I first started, I quickly created some templates and added a few words in them to see if they were rendering correctly. Then I began working on the site properly. Everything was going fine until I tried to test a page in responsive view. Suddenly, everything I'd been adding to my twig templates had disappeared and I was being shown the small amount of dummy text I'd started with, like a cached version of the very first page rendered. I found that switching to responsive mode had logged me out of PW and it wasn't until I logged back in that everything I'd been working on displayed again. The being logged out when switching to responsive mode is weird enough, but a separate issue, (setting $config->sessionFingerprint to false fixes it) but do you know what might be preventing my pages displaying correctly unless I'm logged in? -
Does anyone else get this? Testing a page on the front end in either Chrome or Firefox and if I enable responsive view, I get logged out of the control panel. :?