Jump to content

Tyssen

Members
  • Posts

    339
  • Joined

  • Last visited

Everything posted by Tyssen

  1. Not necessarily. Page title might be terms and conditions, but you don't really want the page name being /terms-and-conditions/
  2. 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.
  3. 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.
  4. Sorry, my memory's not great and I have no idea which project this relates to now. Although it probably involved not using the module in the end and doing a more manual process.
  5. Actually, it seems like probably something else going on with my set-up. I changed some things to fix a different problem, tried re-enabling Tracy, and it's fine now.
  6. I should mention that I get that error in the admin area. If I disable Tracy and then change PHP version to 8, then the admin works OK.
  7. 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.
  8. It turns out that this was the missing piece: curl_setopt($cURL, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0');
  9. Yes, I get successful output with that. Still get 500 with your updated code on my URL.
  10. The PW site will ultimately be the target. Once I have access to the data in PHP I'll be using it as a variable which will then be handed off to Twig templates. The source is already in JSON format.
  11. I've moved it out of PW for now and it's just a plain PHP file in the root of the public folder. I wanted to eliminate PW as being a possible cause of the problem. So what I've posted so far is literally all there is.
  12. 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. 🤔
  13. 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?
  14. 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?
  15. 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>';
  16. 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.
  17. 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?
  18. 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?
  19. 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.
  20. 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. ?
  21. 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?
  22. 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. :?
×
×
  • Create New...