Geen resultaten gevonden
Er zijn geen items die overeenkomen met uw zoekopdracht... Controleer of de spelling van de woorden correct is of breid uw zoekopdracht uit om resultaten te krijgen!
Hi there,
I have a problem with the notification settings results.
I call the notification/settings and the results are:
...
[body] => SimpleXMLElement Object
(
[notification_settings] => Array
(
[0] => SimpleXMLElement Object
(
[id_notification] => xxxxxxx
[id_user] => yyyyyy
[channel] => Curl
[type] => Curl_Default
[destination] => Link (https)
.....
[active] => 1
)
And so on.
The problem is that I'm not able to iterate through the notification_settings elements.
If I call the gettype($xml->Notification_Data->body->notification_settings) it returns "object"
I'm a bit confused. Does someone have suggestions?
Thanks for the help.
OK, I'm able to iterate through the notification_settings elements usin a foreach loop.
Now the question is: does the call always returns array? Even if there is only 1 setting?
Otherwise I think the foreach will raise an exception.
Thank you
Daniele
Hi there,
I use this topic to post another question:
If a notification setting is active like elemt 0 above, the "active" is set to 1. That make sense.
If a notification setting is NOT active like elemt 1 above, the "active" is set to "SimpleXMLElement Object". I wonder why not set this value to 0.
Hi there,
I use this topic to post another question:
If a notification setting is active like elemt 0 above, the "active" is set to 1. That make sense.
If a notification setting is NOT active like elemt 1 above, the "active" is set to "SimpleXMLElement Object". I wonder why not set this value to 0.
The call will not always returns an array since it depends on the library used to read the XML. With your library you use, if there are several elements it will be an array otherwise it will return a SimpleXMLElement Object. But the PHP foreach will handle this well, no worries.
If the notification is inactive the tag 'active' will be empty. It is still your library that parse empty fields into SimpleXMLElement Object.
Sorry for the late response, I hope I have answered your questions.
Hi Thomas,
thank you for the reply.
I added some line of code and it works fine.
However I think that returning an empty field on a logical element is a bug, not a feature.
Empty does not match true nor false. An [active] field should be true(1) or false (0).
Regards
Daniele
Hi Thomas,
thank you for the reply.
I added some line of code and it works fine.
However I think that returning an empty field on a logical element is a bug, not a feature.
Empty does not match true nor false. An [active] field should be true(1) or false (0).
Regards
Daniele
I'm glad to read that you've managed to make it work.
You are right: we should not return an empty field. Unfortunately that's the way it was done back then and now many systems have been built that way. That's why we won't change this behaviour.
I hope you understand this decision, forgive us for the inconvenience.
Dit topic is meer dan 6 maanden oud. U kunt hier niet meer op reageren.
Cookie-instellingen
Informatie over cookies
Onze site gebruikt cookies voor de volgende doeleinden: om u de diensten te leveren die u hebt aangevraagd, om de veiligheid van ons platform te garanderen, om uw voorkeuren te onthouden om het surfen aangenamer te maken, om statistieken te verzamelen om onze site aan te passen aan uw behoeften, om video's weer te geven en om u in staat te stellen inhoud te delen op sociale netwerken.
Sommige van deze cookies zijn noodzakelijk voor de werking van onze site, andere kunnen worden ingesteld op basis van uw voorkeuren.
En savoir plus