We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

SL Google Map Field Type : Google Maps in your CP, SAEFs, and EE templates : Now with map types in the CP

Development and Programming

pab514's avatar
pab514
181 posts
15 years ago
pab514's avatar pab514

Thanks Stephen, really appreciate it,

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis

You’re welcome.

Stephen

       
coko's avatar
coko
119 posts
15 years ago
coko's avatar coko

Hi Steven,

First: thanks for sharing this nice extension.

Second there was a problem here: which after some clearer thinking and a glass of wine 😊 dissapeared like it never was here at all.

Wish list: directions

Thanx again Steven

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis
Second there was a problem here: which after some clearer thinking and a glass of wine dissapeared like it never was here at all.

Wine does that sometimes.

Wish list: directions

Rest assured, it’s already on the v2 wishlist, along with an alarming number of other items.

Cheers, Stephen

       
Dane Thomas's avatar
Dane Thomas
139 posts
15 years ago
Dane Thomas's avatar Dane Thomas
I found a work around for the time being. I put the map custom field call into an embed, and was able to use the {embed:entry_id}-google-map instead of the {entry_id} since {embed} variables are earlier parsed than normal weblog:entries variables. So, working for now, but might be confusing for other in the future.

I’m having trouble getting these embed templates working (two allow two maps on the one page). Just wondering if someone can go into a bit more detail as to how I should setup the weblog entry tags and the embedded google map template and passing the id variable to it.

Cheers.

Edit: more info.

At the moment I have:

{locationMap id="{embed:id}-google-map" class="map" controls="zoom|scale|overview" map="drag|click_zoom|scroll_zoom" pin="drag|center"}
        {map}Unable to display Google Maps.{/map}
{/locationMap}

In a template called googlemap.php

locationMap is my custom field name for the SL Google Map

My main template has

{exp:weblog:entries weblog="Locations" order_by="title" dynamic="on" disable="categories|category_fields|member_data|pagination|trackbacks"}
    <h1>{title}</h1>
    
    {locationAddress}
    
    {embed="contact/googlemap" id="{entry_id}"}
    
    {locationNotes}
    {locationTimes}
{/exp:weblog:entries}

Basically it looks like the ID’s are being passed but the output of the embedded template is outputting html rather than picking up the tags. I’m sure it’s something simple I’ve overlooked.

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis

Hi Dane,

What is being output, using your code?

Stephen

       
Dane Thomas's avatar
Dane Thomas
139 posts
15 years ago
Dane Thomas's avatar Dane Thomas

Hi Stephen,

I’m getting:

{locationMap id="4-google-map" class="map" controls="zoom|scale|overview" map="drag|click_zoom|scroll_zoom" pin="drag|center"} {map}

Unable to display Google Maps.
{/map} {/locationMap}

The other fields in the weblog are getting output (ie the locationAddress field) its just as if the {locationMap} tags aren’t getting parsed cause I’m embedding them?

       
coko's avatar
coko
119 posts
15 years ago
coko's avatar coko

I’m trying to use the div id for targeting some cross page links. The links only direct to the top of the page and not the exact position of the maps.

Mind you I tried a named anchor in some heading next to a map and that didn’t work for me either. So maybe not a specific SL Google Map question …

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis

@oxford That does sound like more of an HTML / CSS issue. I’m pretty sure you can’t start an ID with a number, which may be what’s causing the problem. Have you tried appending the number, rather than prefixing it?

@Dane Thomas

The other fields in the weblog are getting output (ie the locationAddress field) its just as if the {locationMap} tags aren’t getting parsed cause I’m embedding them?

The embedded template is parsed entirely separately, which is probably where the problem is occurring. You could try using another weblog entries loop in the embedded template, displaying only the item whose ID you pass in, but that’s a lot of overhead if you’ve got a large number of records on the page.

Just to confirm this is the problem could you try out the following, and let me know if it works please?

  1. Use a hard-coded ID in the main template.
  2. Use a hard-coded ID in the embedded template.

Cheers, Stephen

       
Dane Thomas's avatar
Dane Thomas
139 posts
15 years ago
Dane Thomas's avatar Dane Thomas

Using a hard coded ID works fine in the main template, but the main reason I was going down this path was to be able to display two google maps on the one page.

Using a hard coded ID in the embedded template doesn’t work - I’m assuming because the embedded tmeplate is being parsed separately (just as you said).

Just wondering how other people have set this up using embeds for two maps.

       
coko's avatar
coko
119 posts
15 years ago
coko's avatar coko

Steven, thanks for the swift reply

Actually, just found a solution, this works for me:

a href=”/index.php/locations#entry_id_262_field_id_106_container”

Still can’t figure out why the named anchor didn’t work I tried it, with succes, on other pages. Anyway I got a working solution for now, learning, as I go along …

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis

@oxford It might be a browser bug; the Google Map div is created on-the-fly using JavaScript, so some browsers might not pick it up. That’s just a guess though.

@Dane Thomas

Just wondering how other people have set this up using embeds for two maps.

No idea, unless they’re doing the whole weblog entries loop within the embed thing. That would certainly work.

Cheers, Stephen

       
Mark Croxton's avatar
Mark Croxton
319 posts
15 years ago
Mark Croxton's avatar Mark Croxton

@Stephen Lewis

Firstly, thank you for a really great extension, I’m using it all over the place.

I’ve written a form automation framework for Codeigniter (a sort of CI equivalent to FieldFrame) and would like to use your javascript map generation code for a Googlemap plugin; there’s no licence at the top of the JS file so can I assume it’s the same as the extension licence (Creative Commons Attribution-Share Alike 3.0 Unported)? I’ll be releasing my code under the same licence. Is that ok with you?

Many thanks,

Mark

       
Stephen Lewis's avatar
Stephen Lewis
466 posts
15 years ago
Stephen Lewis's avatar Stephen Lewis

Hi Mark,

I’ve written a form automation framework for Codeigniter (a sort of CI equivalent to FieldFrame) and would like to use your javascript map generation code for a Googlemap plugin; there’s no licence at the top of the JS file so can I assume it’s the same as the extension licence (Creative Commons Attribution-Share Alike 3.0 Unported)? I’ll be releasing my code under the same licence. Is that ok with you?

That’s fine, thanks for checking with me first. I look forward to seeing the plugin when it’s released.

Cheers, Stephen

       
hothousegraphix's avatar
hothousegraphix
851 posts
15 years ago
hothousegraphix's avatar hothousegraphix

Stephen,

I was just curious if you’re planning to, if at all, port this over as a field type for EE2.0’s new field-type API?

       
First 11 12 13 14 15 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.