Jump to content

kongondo

PW-Moderators
  • Posts

    7,475
  • Joined

  • Last visited

  • Days Won

    144

Everything posted by kongondo

  1. These two posts seems to suggest so. I haven't tried it myself. Maybe you can try and let us know ?
  2. My understanding it is useful in cases where composer is not installed, in which case classes will be loaded from file paths.
  3. Glad you got it sorted :-).
  4. In that case what you want is to rewrite the URL. It is a divisive topic :-). Have you considered alternative, e.g. restructuring your site? Anyway, if you are sure you want to rewrite the URL, this is the go to topic: See the section on URLs. This post might also be relevant:
  5. A $session->redirect does exactly what it says on the tin; it will redirect. It seems you have a parent page called 'pages'. One of its children is 'about-us'. In the frontend, you don't want people to see 'pages' in the URL. You want them to access the parent's children directly. For instance, you want ONLY 'about-us' in the URL. Finally, you don't want a redirect Is this correct?
  6. Given that your field is named images, I am guessing it is a multi image field. This means the field can contain more than one image. This depends on how you set up the field (see its settings when editing the field. Assuming this is a multi image field, you code above won't work. Speaking in very general terms, there are two types of fields: Ones that return only a single value and ones that return multiple values. For instance, an email field will return only one value; the@email.tld. For the fields that can return multiple items, think about it this way... Imagine you have a basket. The basket can contain several fruits. If someone asked you to "give me the fruit"? Your natural response (assuming you are willing to give;-)) would be "which one"? This is because there are multiple fruits in the basket. By requesting the fruit, it implies they want not just any fruit but a particular fruit. That is the same thing you are asking in your code above; "Give me the URL" and ProcessWire is responding with which one? There are several images here, which one do you want? Back to the images, you will need to either specify which image's URL you want or have ProcessWire return the URLs of all the images in the collection (the field on that page). The latter means you have to loop through the images field (collection) as well. Some code.. foreach ($entries as $entry) { $images = $entry->name_of_your_image_field;// e.g. $entry->logo // we want all images so we loop through the image field foreach($images as $image) { // just an example echo $image->url; } } Edit You access a field of a page using its (the field's) name. @see my edit above ($entry->logo). If the image field is of type single, you don't need to loop through it. Just echo its content, e.g. echo $entry->logo;. In other words, there is no API variable called images in ProcessWire.
  7. Not sure you've seen this in the docs ($classLoader) https://processwire.com/api/ref/wire-class-loader/
  8. To answer part of your questions In the example code you've shown, they are using the use operator so they don't need the namespace on top. The use operator is mainly used for giving aliases to names of classes. https://www.php.net/manual/en/language.namespaces.importing.php
  9. Hi @Maverick, Apologies, this slipped under the radar. I will look into this issue and report back ASAP. Thanks.
  10. Very late to this party... Another possibility (just thinking out loud here) would be to set up a temporary hook that will make the changes for you behind the scenes on save page. You'd need to remember to remove the hook when done developing.
  11. Hi @porl, @gebeer, all. Apologies I have not been able to respond to your posts. Unfortunately I still don't have the time to look into the issues raised.
  12. Hi @tinacious, Welcome back to ProcessWire :-). I have gone over your posts several times and I can't make any sense of what the issue is :-). Maybe it's just me but I am wondering whether others too are failing to grasp the issue, hence the lack of responses? I can't tell whether you are talking about the backend or both backend and frontend. What type of field is this? What template is this? What sort of fields are these? I don't get what the page selector is ? What Checkboxes are these? Is it a field somewhere? Maybe a screenshot or a drawing of what you are trying to achieve could help.
  13. Maybe test on a clean install? In case it helps, the role I tested with had some editing permissions, by the way. What permissions do your have?
  14. moderator note: we already have a thread discussing the topic in the thread you started. I have merged your thread here.
  15. I tested your code and it works fine for me; no errors. "Utente loggato" :-). I tested with both my supersuser role and one other non-superuser role. For the non-supersuser, I tested with their language as the default (i.e. in the backend) and also with their language as German (in the backend). I tested with both namespaced and non-namespaced variants of your code as well as with and without sanitising the password. I am wondering whether the issue is caused by the user roles? Have you tried to debug $checkUser? Is everything there OK? Another side note. I don't know your use case but just wondering why you are explicitly stating (error messages) whether it is the email or the password that is invalid for failed logins :-).
  16. How old is the site in terms of ProcessWire version?
  17. Glad you got it sorted. If you don't mind, please edit your first post in order to edit the thread's title to prefix it with [SOLVED] or similar. Thanks.
  18. Just had a quick look. Lines #235-240 in PagesLoaderCache.php have this: if($this->wire('languages')) { $language = $this->wire('user')->language; if(!$language->isDefault()) { $selector .= ", _lang=$language->id"; // for caching purposes only, not recognized by PageFinder } } Line #237 is where the isDefault() method is called. The error you are getting indicates that in line #236, $language returned null. null cannot have the method isDefault(), hence the error. The reason, it would seem, we are getting null is that language is not being set for the current user (or theoretically, that there is no current user? - but don't think so). Maybe try to set a language for the user via the API before you log them in. https://processwire.com/api/ref/languages/set-language/ On a side note, why are you sanitizing passwords? :-).
  19. Maybe I have been staring at my empty coffee mug for too long but I don't get the logic behind this :-). Could you please explain your use case some more? My thinking is that you delete things you no longer need and are sure you won't need. None of these seems to apply to your images. If you need them as some external resource, then why delete them in the first place? Secondly, depending on the number of pages and/or images involved and the frequency of the 'change image operations', you might be creating more headache for yourself in the future. You might end up with lots of orphaned image files in the sense that they are no longer being tracked by ProcessWire. You would have to dig into the file system to do maintenance. You would have to come up with a system for which images are still in use in ProcessWire and which have been decoupled but still in use as external resources. And what about images that may no longer be in use as an external resource? This sounds like a nightmare scenario to me. So whilst you could probably copy the images before they are deleted, I don't think that's the first approach to consider. Maybe if you could give us a better description of the situation including whether those external sites are ProcessWire sites. Please also explain why you want to delete the images in the first place. Hopefully we can then suggest other solutions and/or approaches, even about the external linking part :-).
  20. This seems to have been an issue with sites installed in sub-folders. I'll fix this in next update. Thanks.
  21. How would you React if I said I love Vue? ?
  22. Just FYI, PHP has a NumberFormatter class. https://www.php.net/manual/en/class.numberformatter.php
  23. True. It should be the work of the Fieldtype to make sure it is saving correctly formatted values to the DB. So, I would file a bug report
  24. My guess. English decimal versus German comma ? Meaning, it is what I mentioned earlier. A data mismatch...
×
×
  • Create New...