Get whole tree of a taxonomy term from node into seperate php variables Can anyone of you brainy folk suggest the best way of retrieving the taxonomy term on a node and both of it's parents then storing as variables on a php snippet?
For example: Country->City->District output to $country, $city and $district?

Thanks in advance for all your answers!...

nb, this is what I get from print_r, [0] being the country, [1] being the area and [2] the district:

field_location_term] =&gt; Array
    (
        [und] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [tid] =&gt; 26
                        [taxonomy_term] =&gt; stdClass Object
                            (
                                [tid] =&gt; 26
                                [vid] =&gt; 5
                                [name] =&gt; B----a
                                [description] =&gt; 
                                [format] =&gt; filtered_html
                                [weight] =&gt; 3
                                [vocabulary_machine_name] =&gt; geographical_location
                                [metatags] =&gt; Array
                                    (
                                    )

                            )

                    )

                [1] =&gt; Array
                    (
                        [tid] =&gt; 27
                        [taxonomy_term] =&gt; stdClass Object
                            (
                                [tid] =&gt; 27
                                [vid] =&gt; 5
                                [name] =&gt; B----o
                                [description] =&gt; 
                                [format] =&gt; filtered_html
                                [weight] =&gt; 0
                                [vocabulary_machine_name] =&gt; geographical_location
                                [metatags] =&gt; Array
                                    (
                                    )

                            )

                    )

                [2] =&gt; Array
                    (
                        [tid] =&gt; 28
                        [taxonomy_term] =&gt; stdClass Object
                            (
                                [tid] =&gt; 28
                                [vid] =&gt; 5
                                [name] =&gt; M----w
                                [description] =&gt; 
                                [format] =&gt; filtered_html
                                [weight] =&gt; 0
                                [vocabulary_machine_name] =&gt; geographical_location
                                [metatags] =&gt; Array
                                    (
                                    )

                            )

                    )

            )


I thought the best thing to do would be 

$country = $node-&gt;field_location_term['und'][0]['taxonomy_term']['name'];


But I get no output.
It appears from your printout that taxonomy_term is an object, not an array. So your code would look like this:

$country = $node-&gt;field_location_term['und'][0]['taxonomy_term']-&gt;name;


You might not be able to do the object->['array']->object->['key'] thing. It might need to be broken into:

$foo = $node-&gt;field_location_term['und'][0]['taxonomy_term'];
$country = $foo-&gt;name;