0

Hi wondering if anyone can help.

Using Google maps for expression engine from Objective html.

I have a channel called "franchise"

In each of the entries i will have "one" plot based on their postcode.

{exp:channel:entries channel="franchise" status="open" dynamic="on"}
  {exp:gmap:init id="map" scrollwheel="false"  style="width:100%;height:300px"}
  {map_position id="map" zoom="10"}
{/exp:channel:entries}

The above code is on the view page of the entry, This all works great for showing that one marker and even if i add another marker using the fieldtype that works great also. Just to check though this is the correct syntax? Obviously it works but if anyone can tell me if it is wrong in any way would be much appreciated.

Anyway...

I am wondering how i can have a main page that pulls through all the plots from every entry that have been added into the fieldtype and the syntax i need to pull that through. I have had a look at the docs but cant quite get my head around it.

When i click the marker i want to be able to show the title of the entry also.

Thanks to anyone that can help.

1 Answer 1

0

Not quite sure if I understand you, but if you want to return all entries in the channel and plot them, this is similar to what I'm using:

{exp:gmap:init id="map" scrollwheel="false"  style="width:100%;height:300px"}
{exp:channel:entries channel="franchise" status="open" dynamic="off"}
{exp:gmap:marker
    id="map"
    latitude="{franchise_latitude}"
    longitude="{franchise_longitude}"
    geocode="false"
    clustering="true"
    icon="{url}images/map-icon-{categories}{category_url_title}{/categories}.png"
    infobox="true"
    offsetY="-55"
    offsetX="30"
    closeBoxMargin="5px"
    class="infobox-{categories}{category_url_title}{/categories}"
    closeBoxURL="{url}images/close-icon-retailer.png"
    open_windows="false"
    style="width: '180px'"
}                           
    <h3>{title}</h3>
    <p>{franchise_address}</p>
{/exp:gmap:marker}      
{/exp:channel:entries}

That assumes each entry has been geocoded, though.

1
  • Cheers mate, managed to do it. But this clarifies that ive done it right. Didnt realise you had to use the field type to fill in the lat and long at the time. Thanks for your reply. Commented Sep 22, 2014 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.