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
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.
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?
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 …
@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?
Cheers, Stephen
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.
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 …
@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
@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
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
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.