I am utilizing a combination of Solspace 'Calendar', 'Playa', and 'Google Maps for ExpressionEngine'. I'm having a strange issue where the dates aren't showing up correctly in my infowindows on the Google Map, but they show up fine using the same code outside of the infowindow.
So, I have a 'Location' channel, and an 'Event' channel. The Event channel is associated with the Calendar module, and uses a Playa single relationship field to relate it to a Location.
I am adding markers to the map for every 'Location', and for each marker, I'm populating the infowindow with the Location details. this includes using the Playa:Parents method to show all of the events that are at that location.
I copied the code from the Solspace Calendar demo template for a single event to show the event date, because it had all the conditionals all worked out to deal with single day or multi-day events well.
My problem is that in the infowindow, it's only showing the 'From' date, and not the 'To' part of the date string. It shows it correctly when I output it outside of the map, though. Here is the code that is outputting the date information.
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
But this is how it outputs, in the infowindow, and outside of the map.
(crap, I don't have enough 'reputation' to post the image here, but it's here: http://paleosun.com/misc/stackexchange-map-calendar-question.jpg)
Notice, the section below the map has the "to" date. Same code is used to output it.
I have determined that something is going wrong with the quotes in the event date formatting tags. The {if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"}
part is never resolving to 'true' like it should. In fact, If I just try to output {event_first_date format='%Y%m%d%g%i%a'}
in the infowindow part, nothing show up. However, if I use double quotes and output {event_first_date format="%Y%m%d%g%i%a"}
it DOES work. The problem is, I cannot use that fix in the conditional, because double quotes are already being used around the output of that tag...
Any ideas why? Or what I can do as a work-around?
Here is all of my relevant template code:
{exp:gmap:init
id="mainmap"
class="gmap"
style="height:600px;width:100%; border: 1px solid green;"
center="United States"
zoom="4"
}
<div id="location-container">
{exp:channel:entries
channel="location"
disable="member_data|pagination|category_fields"
limit="9999"
}
{if loc_show_on_map == 'yes'}
{exp:gmap:marker
id="mainmap"
latitude="{loc_latitude}"
longitude="{loc_longitude}"
geocode="false"
clustering="true"
infobox="true"
show_one_window="true"
class="ui-infobox-dark ui-infobox"
offsetY="-45"
offsetX="15"
icon="{categories limit='1'}{category_image}{/categories}"
}
<div style="width: 400px;" class="clearfix">
<h3><a href="{path=find-music/location/{url_title}}">{title}</a></h3>
<ul>
{categories}
<li>{category_name}</li>
{/categories}
</ul>
{if loc_image}<img src="{loc_image}" alt="{title} image" width="200" class="right" />{/if}
{loc_contact_first_name} {loc_contact_last_name}<br />
{loc_street_address} {if loc_address_details}{loc_address_details}{/if}<br />
{loc_city_town}, {loc_state} {loc_zip_code}<br />
<ul>
{exp:playa:parents channel="calendar_events"}
<li>
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
<br />From:{event_first_date format='%Y%m%d%g%i%a'}
<br />To: {event_last_date format='%Y%m%d%g%i%a'}!
Yes
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
</li>
{/exp:playa:parents}
</ul>
</div>
{/exp:gmap:marker}
{!--
custom javascript to add attributes to the markers
for location type and music styles, so we can filter
based on that
--}
<script type="text/javascript">
if(typeof newMarker!='undefined'){
newMarker.entry_id = {entry_id};
newMarker.music_styles = [];
{exp:playa:children field="loc_music_styles"}
newMarker.music_styles.push({entry_id});
{/exp:playa:children}
newMarker.location_types = [];
{categories}
newMarker.location_types.push({category_id});
{/categories}
}
</script>
{/if}
<div id="location-{entry_id}" class="location-entry clearfix">
<h3><a href="{path=find-music/location/{url_title}}">{title}</a></h3>
{if loc_image}<img src="{loc_image}" alt="{title} image" width="200" class="right" />{/if}
{loc_contact_first_name} {loc_contact_last_name}<br />
{loc_street_address} {if loc_address_details}{loc_address_details}{/if}<br />
{loc_city_town}, {loc_state} {loc_zip_code}<br />
<ul>
{exp:playa:parents channel="calendar_events"}
<li>
{exp:calendar:events}
<b>From:</b> {event_first_date format="%F %j, %Y at %g:%i%a"}
{if event_never_ends}
(never ends)
{if:else}
{if "{event_first_date format='%Y%m%d%g%i%a'}" != "{event_last_date format='%Y%m%d%g%i%a'}"} <b>to:</b>
{if "{event_first_date format="%Y%m%d"}" != "{event_last_date format="%Y%m%d"}"}
{event_last_date format="%l, %F %j, %Y at %g:%i%a"}
{if:else}
{event_last_date format="%g:%i%a"}
{/if}
{/if}
{/if}
<a href="{path=find-music/event/{url_title}}">{title}</a>
{/exp:calendar:events}
</li>
{/exp:playa:parents}
</ul>
<hr />
</div>
{/exp:channel:entries}
</div> <!-- /#location-container -->