php to retrieve child nodes

Permalink
OK, I'm very very new to php.

I need to retrieve a datum field 'url_thumbnail' from an external site.

The following code works fine, apart from retrieving the image field. I'm guessing this is because (on the external site) the 'url_thumbnail' datum field is a child node of 'image' which is a child node of 'images'. I just don't know how to write this in php...?

$image = $tour->image.''; (I think I need to change this line of code...?)

...
         $tour = x;
         $channel = xxxx;
         $result = $tc->show_tour($tour, $channel);
         $tour = $result->tour;
         $image = $tour->image.'';
                        echo "<img src='".$image."'/><br />";
         echo $tour->tour_name.' - from only '.$tour->from_price_display;
...

 
PJSAndo replied on at Permalink Reply
Ok, figured this out.

So, if you need to retrieve a node (e.g. url_thumbnail) which is child of 'image', which is a child of 'images'

rather than something like $image = $tour->url_thumbnail.'';

you would use

$image = $tour->images->image->url_thumbnail.'';

and then echo the value

echo "<img src='".$image."'/><br />";