Jump to content

cjx2240

Members
  • Posts

    100
  • Joined

  • Last visited

Everything posted by cjx2240

  1. I'd like to make a tiny tweak to the ajax page search in the top right corner of the CMS. All I want to do, is add the page's rootParent to the result dropdown. This is because due to the unique structure of a certain site, lots of pages have the same name, it's not clear which one to click on. Can anyone help me out with this please?
  2. Thanks for the suggestion, I will look into that. The suggestion to hook into pages::find seems useful, but is that advisable? Surely pages::find is happening a lot throughout the site, don't want to go slowing the site down (forgive me if I'm displaying some ignorance on how hooks work) On a similar note, I have ticked for this field "allow unpublished pages" which works for superusers, but not a secondary manager role I've set up (even though again, it works for regular InputfieldPage fields), any ideas what permission needs giving?
  3. I'm hooking into InputfieldPage::getSelectablePages In order to limit the results to a certain parent, on a multi-site setup. This works great. However I can't seem to do the same thing for an ASM Autocomplete style field. Does anyone know how I would go about this? Thanks
  4. Hi @Wanze - great module by the way Please can you tell me how I can omit or override the og:url tag? I have made changes to the URL structure of one particular page tree of my site, to remove the parent name from the url string. This is carrying over to SEO maestro for all but the parent page. I tried unsetting it in the renderMetatags hook, and overwriting it with $page->opengraph->url = "new url"; in the template, but to no avail. Edit: I see by looking into the module that the og:url is just set from httpUrl and can't be overwritten like other aspects
  5. Hi @flydev ?? - thanks for the suggestions. Actually this site is using Session Handler Database module but this pointed me towards that at least. Removing that module fixes it (had to manually remove it because I got the "forged" CSRF exception when trying to uninstall it) Not sure exactly why it was giving me grief with this particular site. I found another thread saying to change the sessions "data" column to mediumtext might solve this but it already was...
  6. Hi I've just inherited a ProcessWire site built by someone else and I'm hitting an error when unpublishing a page. (The error appears like a js alert with "undefined" as the message) In logs, I get the following: URL: /login/page/?action=unpub&id=3769&render=json Text: CSRF token does not match (in D:\sites\***\public_html\wire\modules\Process\ProcessPageList\ProcessPageList.module line 434) Does anyone have any ideas? This happens locally and on the production server. I'm also hitting a lot of "Session appears to be forged" issues. Site is on ProcessWire 3.0.142 Thanks
  7. This module works wonderfully and it really helped me a lot, so I just want to say thank you
  8. After a lot of googling and many years this still seems like one of the best approaches to remove an undesirable part of a URL. For example, if you wanted to group a bunch of landing pages as children of "Landing Pages" but you didn't want /landing-pages in your URL. However I did run into a pretty significant issue with it, it bypasses any permissions you have to prevent page view. So if guests dont have permission to view the page, it will still load that page
  9. I just want to say I love this module. It means I can have repeatermatrices made up of fieldsets, while also using those fieldsets on their own elsewhere, with much less clutter. Thanks for making it! Would it not make more sense though for the provided option to be added to Input > Admin theme settings (Uikit) ? Then also it could be overriden from within a template/repeater field group. I think this would be really helpful because while you're likely to not want the title/padding when loading a fieldset within a repeater matrix, you're likely to want it when loading a fieldset in a more standard context.
  10. Hi Ryan, are you aware that some live pages of the modules directory have been a bit broken for a while? eg https://processwire.com/modules/seo-maestro/
  11. Sorry to bump an ancient ancient thread but it seemed to me a fitting way to point out that, at least for me, this issue still exists 5 years later - and this post nearly tops google for "processwire ckeditor figcaption" Does anyone have a better way around this than "add pictures at the end"? As this isn't a particularly fitting instruction for a third party. It seems to me that there's two solutions that could be done, 1 - manage the caption in the image popup, or 2 - pressing return while in the caption tag should escape the entire figure tag.
  12. Hey thanks for the idea, weirdly I set the baseUrl to a blank string, and that fixed it. I can't say I'm satisfied with understanding where things went wrong, but at least I can move forward for now!
  13. Hello Following a few guides on removing parent urls, and multilingual site setups, I have create multiple homepages for my website. For the parent language however, I've removed the parent name from the URL using the following in ready.php (mashed together from some other threads - on a side note please let me know if this is a terrible approach) wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->rootParent(1057)) { $event->replace = true; $parents = "/"; foreach($page->parents() as $parent) { if($parent->id != 1 && $parent->id != 1057) { $parents .= "$parent->name/"; } } $event->return = $parents.$page->name."/"; } }); There's more to it than this, but I think this is the relevant part. And it's working great everywhere, except when it comes to rendering pagination [edit: within a repeater matrix, I should mention], for which my URLs are doubling up when they render, like so: /parent/page/parent/page/page2 Any ideas how I can prevent this would be greatly appreciated.
  14. Got a bit of a weird one. I've got a date field, I've added a date in two different pages using the calendar selector. It has saved, and stored in the same format in the database. I can echo out the date no problem for both dates, it exists. However, if I use strtotime() (or wireDate()) on this date, one of them works, and one of them does not. var_dump($page->custom_date); var_dump(strtotime($page->custom_date)); 1: 2:
  15. As is so often the case from the magic of rubber duck programming, I realised that $category needs to be the page I've made. While ProcessPageExportImport probably does something clever with those paths, in my case I needed $page->categories->add($pages->get("path=$category"));
  16. How might I populate a page reference multi-select field (with options limited to pages of a specific parent) using the API? I'm doing some manual data importing and I have some categories in json like this (which came from the first-party Export/Import module) "categories": [ "/categories/dance/", "/categories/film/", "/categories/poetry/" ], The pages are all set up correctly on the source site, with the same names I've done images, repeaters etc, but I'm not clear on the syntax for populating a pagereference field. Something like $page->categories->add($category); (Where category is that path from the loop) Is what I was hoping for
  17. Can this module be used to do something like, change the allowed filetypes of a file field, or change the available options in an options (select) field?
  18. I combined dotnetic's suggestion with elabx's hook: <?php $wire->addHookAfter("InputfieldCheckbox::render",function($event){ $field = $event->object; $output = $event->return; if($field->name == "privacy_policy_accepted"){ $output = str_replace($field->entityEncode($field->checkboxLabel), $field->checkboxLabel, $output); } $event->return = $output; }); ?> Basically undoes the encoding
  19. I figured this out in the end, if anyone ever needs the answer in the future, I had to combine the first and last ideas, plus also exclude the first item from each page, and set the count one higher. There might be a better way but this is what I'm going with: if($input->pageNum < 2) { $featured = $pages->find("template=news-article")->first; $featuredId = $pinned->id; // template for first item goes here } else { $featuredId = 0; } $newsItems = $pages->find("template=news-article, id!=$featuredId, limit=11"); // 1 more than you want so you can exclude it in the template foreach($newsItems as $item) { if($item->id != $featuredId && $item != $newsItems->first()) { // template for all other items } }
  20. Hi, I'm struggling with what seems like it should be very straightforward. I want to feature the first item of my blog in a bigger more detailed template, then list ten more items and pagination. How do I exclude my first item from the results list, but still loop through and paginate through ten other results? Sounds dead simple right? I have tried several "obvious" methods to exclude the first item from the selector, which works fine, but the issue happens when you go to page two, it does not start the next page in the right place or it does not retrieve the right number of items. Things I have tried: // exclude the first item by id $newsItems = $pages->find("template=news-article, id!=$featuredId, limit=10"); // exclude with a slice $newsItems = $pages->find("template=news-article, limit=10")->slice(1); // start after item 1 (this just makes all pages start at item 1) $newsItems = $pages->find("template=news-article, start=1, limit=10"); // keep the item but don't include it in my template, this leads to the wrong count of items on page 2 foreach($newsItems as $item) { if($item != $pages->find("template=news-article")->first()) { //etc } } As an alternative solution, is it possible to have a different count on a different page? Then I can simply include the featured item in the loop but style it differently. Again I have tried the obvious (change the count of the selector if $input->pageNum > 2) but it doesn't work
  21. I've got a basic form with method="get" I use $input->get to retrieve the category, and show a list of pages based on this result. Works fine on PC, and on Mac Firefox. However on Safari and Chrome for Mac, I get nothing. If I try to var_dump($input->get), I get a white page, even if debug is enabled. It also works fine with $input->post Why does this work on one browser and not another, can anyone help please?
  22. Hi, I have quite an unusual method of selecting pages. I need to search against 3 pairs of "min" and "max" fields, and return anything that overlaps any of the ranges. The only way I can see that this is possible, is to exclude results where both fields fall outside of the ranges. This is quite hard to wrap your head around (I know, I've had a hard enough time myself) but I feel like I have the logic right. The integers used in this example are my search figures. $pages->get("parent=1042, (!comp0_min_high>200, !comp0_max_override<100), (!comp1_min_high>50, !comp1_max_override<10), (!comp2_min_high>50, !comp2_max_override<10)"); So what should happen, as far as I understand is (not A AND not B) AND (not C AND not D) AND (not E AND not F) However, using Tracy Debugger to dig into the query, it seems to use "OR" between each of those subqueries, instead of "AND". Is this my fault? I thought separating selectors by a comma was essentially "AND".
  23. On the off-chance that anyone else stumbles on this and thinks it's a solution for what they need, you should set the field to readonly, instead of disabled. Otherwise ProcessWire looks for a value, doesn't find one, and saves it as empty, meaning you'll wipe all the fields on a save.
  24. For me, it happens with any field. As soon as you set it to "Open when populated + Closed when blank + Locked (not editable)" - it vanishes from the CMS. While editable, it appears, with a 0 in it. Using HTML5 input doesn't help. The same thing happens if you set access level to view and not edit. The best thing I can think to do is leave the fields open and forcibly make them disabled with javascript or a hook instead. On a related note once I changed a textareas field to use HTML 5 input, I started getting this error on every save: InputfieldForm: Warning ('showIf' from 'Markup/HTML (Content Type)'): dependency field 'contentType' is not present in this form. - ProcessFieldEdit But my profields license expired a long time ago so I can't do much about this. Is there somewhere to report both these issues?
×
×
  • Create New...