Jump to content

prestoav

Members
  • Posts

    221
  • Joined

  • Last visited

Everything posted by prestoav

  1. Hi @horst Thanks for your repay. $config->debug is on and no errors there. I've also checked logs and nothing showing up there either sadly ? I've also uninstalled the 'Page Rename Options' module in case that was interrupting the process but that made no difference either. Finally I've updated the client server to PHP 7.4.21 but that didn't change anything.
  2. Hi Andreas, Thanks for the information and glad I'm not alone! I just tried a copy on my local MAMP install (PHP 7.4.21) and that worked just fine. On the client's DV server (PHP 7.3.33) it won't work. I'm not keen to change the client's PHP version yet but I could if it comes to that.
  3. Hi there, PW 3.0.165 I have a multi-language site where I need to change the URL slug / name of the page. Current names are: /en/page-name /fr/page-name /de/page-name etc. ('page-name' is actually something else) I go into the page in admin and change (under settings) to the following: /en/page /fr/page /de/page (again, 'page' is something else but just a single word, no spaces or special chars) But when I save the page and look again all the names are back to: /en/page-name /fr/page-name /de/page-name etc. Is there a template setting or similar I have missed where you can prohibit name changes? I'm not getting any warnings about it and I can't see one but I'm sure I'm missing something! Any help really appreciated!
  4. Hi @Robin S this is super helpful and makes complete sense. I was arriving at that conclusion but your explanation and examples really help. When I have it working I'll post final code here for anyone looking in future.
  5. Hi @Robin S Thanks again for the code above, really useful. I'm getting a lot of this to work now except the actual the actual upload of the file itself. The list of file names generates properly to the $_POST['images'] and is readable and correct if you print_t the $image_names. However, the image isn't uploading and I'm getting this error : Error: Exception: Unable to read: /site/assets/files/21526/img-1.png (in wire/core/Pagefile.php line 230) There is no file uploaded to that directory. Note: 21526 is the page ID, img-1.png is the correct name for the uploaded image. Further down the error text the issue seems to originate from this line: $pageimages->add($pageimage); Here's my full PHP ($pte is the page itself assigned elsewhere and tested as working): // Update Images // Look for the comma separated value in POST $images_value = $_POST['images']; // If the value exists then the form was submitted & we need to update image fields if($images_value != '') { // Explode the comma separated value to an array of image basenames $image_names = explode(',', $images_value); // Add empty images if no image added or removed if (count($image_names) < 4) { $blanks = 4 - count($image_names); while ($blanks > 0) { array_push($image_names, ""); $blanks = $blanks - 1; } } // Create a Pageimages object using the individual image basenames $all_images = new Pageimages($pte); foreach($image_names as $image_name) { $all_images->add($image_name); } // Turn off output formatting because we are about to set field values $pte->of(false); // Loop over the image basenames foreach($image_names as $index => $image_name) { // Get the Pageimage from $all_images $pageimage = $all_images->get($image_name); // Create a new empty Pageimages object $pageimages = new Pageimages($page); // Add the Pageimage if ($pageimage != '') { $pageimages->add($pageimage); // Determine the field name that will be updated if ($index == 0) { $image_field_name = 'page_image'; } else { $image_field_name = 'product_image_' . $index; } // Set the field value $pte->$image_field_name = $pageimages; } } } $pte->save(); You'll see I've added blanks to fill in empty / missing fields as the front end form allows for images to be deleted so I need to populate those with no image if they have been deleted. Also, you'll note that the first image field to upload to has a different name. This is a legacy issue I'm dealing with... Any ideas on why the image isn't being uploaded would be really helpful!
  6. OK, I found the problem. OPCache was enabled in the new version of MAMP Pro. Just turned it off and everything refreshes as it should. Hope that helps someone!
  7. Hi @Laikmosh, I think I have disabled all caching modules in PHP, certainly socache and file_cache_module. In terms of the cache expiry time, I'm not sure to be honest. If you have any ideas where that might be hiding I'd greatly appreciate it!
  8. I wondered if anyone has seen this and maybe has a fix? After editing Page templates are saved but code updates do not update the rendered immediately, even with a hard refresh of the page (shift+refresh). It seems to cache the page for a few mins (3-4) regardless of PW / MAMP cache settings. This applies to rendered HTML, rendered PHP variables and site_debug errors. I'm experiencing the same thing on Google Chrome Firefox. PW 3.0.184 Anyone else seen this and / or found a fix?
  9. Hi @Robin Wow, what a seriously awesome reply thanks so much. I'm going to be implementing this today. Thank you!!
  10. I am re-working an advert editor on a marketplace site and one of the most requested features is to be able to reorder the images that have been uploaded. To do this I need to be able to move existing images between separate page fields (let's call them image_1, image-_, image_3 etc.). The fields are all setup to have only one image each in the field setup. So far I have the functionality sorted to allow advert owners to delete images or upload replacement images for each field if needed and that all works fine. I also have an edit form that tracks the images as they are dragged around in JQuery UI so that, when the edit form is submitted, they post-processing can see the original field the image was in and the intended field that the image needs to move to as a result of the reordering. I'm now stumped as to how to best move the actual files around so they show in the right order, both in the live advert and in the edit form if it's edited again. Has anyone found a good way to do this? The stumbling block is that each field can only tae one file at a time so it feels like I need to move all the files to be moved into a temporary location then move them back into the right, new spots. Any suggestions very much appreciated!
  11. Works a treat, thank you ?
  12. Superb, thanks I'll try that out!
  13. I'll certainly look into that.
  14. @Robin S Thanks for getting back to me. Your initial suggestion does work on live sites in a domain root but, sadly, not in a development environment where different sites are housed on sub folders. For example, if the site is at www.mydomain.com then the resulting link is www.mydomain.com/admin/page/edit/?id=1016 and this works from all admin pages. However, if the site is at localhost:8888/dev_site_1/ then the link created is localhost:8888/admin/page/edit/?id=1016 (i.e. the 'dev_site_1' is missing) and the resulting link does't work. I'll investigate the hook method of course but many devs might find this useful to work in their framework sites. Thanks again for the good work.
  15. Nice work @Robin S! One Issue I've come across that I'd be really keen on a solution for is to support $config->urls in the URL field. For example, I have a 'Site Settings' page in all my sites where the client can edit the global company details like phone, email, address etc. I'd like to add a link in the top admin bar to this page so it's easy to find (some sites have a lot pf pages in the tree)! I can do it once the site is launched with an absolute URL but I'm struggling with a relative URL that I can add to my Framework site. This is because the correct relative link depends on the page the 'Settings Page' was accessed from: This would work from another edit page: ../../admin/page/edit/?id=1016 However, it would need to be this from the page tree: ../admin/page/edit/?id=1016 One fix would be to support $config->urls in {} e.g. {$urls->admin}page/edit/?id=1016 As per these docs: https://processwire.com/api/ref/paths/ Hope this helps and thanks for the module!
  16. Thanks BitPoet. I was using AoS for a while but I found it didn't play nicely with the admin UI Kit theme in places and I understand AoS is no longer being developed so I've stopped using it in production. It's a shame because it really did add some nice features.
  17. Hi Zeka, Doh, I can't believe I didn't spot that! thanks for the tip. Marked as solved.
  18. Hi folks, I've set up a field to link to an other internal page and with a Input Field Type of Page List Select. All work well until you want to remove a selection altogether. Adding a page in from the list or changing it is fine but I can't find a way for the editor (or Superuser) to remove a selection once it's made. See screen grab attached. Clicking on 'Change' shows the list of pages to choose from but no way of removing any selection to leave it blank. I ended up deleting that line from the database manually but obviously that's not a solution. Anyone found out how an editor can do this? PW 3.0.165 Thanks!
  19. Hi there. Yup, you guessed it. Thank you, I can't believe after all this time I missed that!
  20. PW 3.0.165 / Admin Theme UIKit Today's head scratcher! I have 20+ PW sites running on my localhost under MAMP at localhost:8888, many of which are PW 3.0.165 / UIKIt Admin theme. Today I noticed on one site the admin 'View' links in the page tree and the page editor are removing the port number from the URL. so rather than linking to 'localhost:8888/site/page' they are linking to 'localhost/site/page'. To make things even more weird the other admin links ('edit' for example) leave the ':8888' intact. Finally, it's only happening on one site, the others on the same host are fine. I've looked at the .htaccess and there are no rewritebase rules in operation. I wondered if anyone else had seen this and figured out what that may have happened on any thoughts on possible reasons? Thanks, as always, in advance.
  21. Yup, that's it exactly, I have MultiLang installed but only one language (me default installation ready for multilang sites). I'll mark this solved. thanks for the link to that thread @wbmnfktr ?
  22. Hi all, I could have sworn I used to be able to use the site generic 'title' field as a sub field of a repeater field. However I've tried to do this on two 3.0.165 sites recently and, while it will add the title field in the repeater field setup, it wont save the repeater title sub field's content when the repeater is used in a page template and edited. It;'s not a big issue but I wondered if this was a known restriction?
  23. Hi @matjazp, Thank you for your help, I'm not sure I would have tracked this down without that last suggestion to comment our the hidden visibility. Long story short it was my own fault! I built this site a long time ago and, in my naivety back then, added a protection line at the beginning of the main admin.php template that redirected front end users if they were to ever stumble on a real admin page using Fredi (the previous FE editor I was using). That line was redirecting front end users as soon as FEEL was trying to open an admin page. Oddly that wasn't happening with Fredi!?! Anyway, it's now working as expected and it was my fault not the module! Thanks again!
  24. The more I look at this the more I suspect a permissions issue. It works perfectly for the Super User, just not for any other role. Checking the permissions for the 'editor' user like this, just before the call to FEEL to create the edit button: $perms = $user->getPermissions(); foreach ($perms as $perm) {echo $perm->title . " | ";} if ($page->editable()) {echo "Page is editable.";} I get this: "View pages | Edit pages | Delete pages | User can update profile/password | Page is editable." Every piece of evidence is suggesting it should work for the user but it just doesn't unless the user is a super user. ?
  25. Hi @matjazp I'll do that as I'm really curious to see what's going on. It makes no sense that it works for the super user but not other user roles, even when they apparantly have the same permissions for page edit and creation.
×
×
  • Create New...