access lat/lon from computed field

jimkont - July 9, 2008 - 11:21
Project:location (API, module)
Version:5.x-2.7
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

hi,
i am trying to access location data (lat/lon) from cck computed field

which is the proper syntax?

i tried out the following without success:

$node->locations[0]['latitude']['value']
$node->locations[0]['lat']['value']
$node->locations[0]['latitude']
$node->locations[0]['lat']
$node->locations['latitude']
$node->locations['lat']
$node->locations['latitude']['value']
$node->locations['lat']['value']

$node->location[0]['latitude']['value']
$node->location[0]['lat']['value']
$node->location[0]['latitude']
$node->location[0]['lat']
$node->location['latitude']
$node->location['lat']
$node->location['latitude']['value']
$node->location['lat']['value']

an empty string is returned...

i noticed that when location is used in blocks, load_load() is called,
however this function cannot be used inside computed field because node data is already loaded in $node and page crashes if used...

any help???

thanks!

#1

jimkont - July 21, 2008 - 16:28

this is how i finally made it work

$loc = location_load_locations('node', $node);
print $loc['locations'][0]['lat'];

 
 

Drupal is a registered trademark of Dries Buytaert.