Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
How to get $node->locations[0]['latitude'] & $node->locations[0]['longitude'] for the node in CF?
How to get $node->locations[0]['latitude'] & $node->locations[0]['longitude'] for the node in CF?
Comments
Comment #1
stfb CreditAttribution: stfb commentedSame problem.
I have a location field named "field_fd_plan".
When I put this in the computed field : $node_field[0]['value'] = $node->field_fd_plan[0][lid];
It works ! I get the location ID.
BUT
trying getting the name or latitude or whatever returns null.
This code is working ok if I put it in the node.tpl file :
print gmap_simple_map($field_fd_plan[0][latitude], $field_fd_plan[0][longitude], '', $field_fd_plan[0][name], 14, 'default', 'default', true, '' );
But if I put : $node_field[0]['value'] = var_export($node->field_fd_plan, TRUE);
on the CF i get this :
array ( 0 => array ( 'lid' => '1', ), )
Seems that all the informations but the lid disapeared !
How can I fix this ?
thanks ;-)
Comment #2
pvasili CreditAttribution: pvasili commentedsample code in the node-[type-of-node].tpl.php
....
print $content;
....
?>
Comment #3
stfb CreditAttribution: stfb commentedIn the status report section I had a warning about a database script update for the location module which has not been run.
After running it, still the same problem :-(
Comment #4
stfb CreditAttribution: stfb commentedSome news.
What I'm trying to do :
I have a node which displays content in tabs. I use the tabs module.
I want to display a google map inside the "contact" tab.
To display the map, I've installed the gmap module + computed field module.
I've added a computed field to my content type which contains the google map code which displays the map.
The problem :
See #1
The solution:
I haven't figured out how to get those coordinates from inside computer field but I've found an other solution.
I now Use content-field-FIELDNAME-TYPENAME.tpl.php file.
Say, you have a location field named fd_plan using the content type test.
To display the map you just :
1- add a new file named content-field-fd_plan-test.tpl.php at the root of your theme dir
2- copy the content of content-field.tpl.php, that you find in modules/cck/theme inside this new file
3- add your gmap code in content-field-fd_plan-test.tpl.php just after "endforeach;?>" (you can put it where you want outside the foreach, this is for test purpose). The end of the file should look like this :
It's not resolving the bug but I hope this will help people with the same problem.
Comment #5
Moonshine CreditAttribution: Moonshine commentedMoving to support...
Comment #6
mmjvb CreditAttribution: mmjvb as a volunteer commented