Jump to content

Map for two page reference fields


hezmann
 Share

Recommended Posts

Hi,

I'm sure this is simple but I just can't seem to get my head around it.

I have a template walk_segments which has two page reference fields start_town and end_town.  Both of those fields reference walk_towns which has a Maps Marker field called marker.

I would like to get a map in the Walk Segments which has markers for both the start_town and end_town.  I can't figure out what to put in the selector to get that.

$items = $pages->find("template=walk_towns, marker!='', $page->start_town, sort=title");
$map = $modules->get('MarkupGoogleMap');
echo $map->render($items, 'marker');

Any help would be most appreciated!

Heather

Link to comment
Share on other sites

A Map Marker field has several subfields. You would pick one of these subfields as a basis for determining whether or not you consider the field to be populated: 'lat' is probably a good one.

$items = $pages->find("template=walk_segments, start_town.marker.lat!='', end_town.marker.lat!='', sort=title");

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...