I'm a real newbie in javascript, and I need som help to acheive a proper integration of mapbox maps inside koken (a CMS for photographers)
The idea is to do some thing like this https://www.flickr.com/map to present pictures on a map.
Now my code looks like this :
<div id='map' style="height: 800px;"></div>
<script>
var map = L.mapbox.map('map', 'mymap')
.setView([48.895513333333, 2.39237], 6);
//loop to create markers
<koken:load limit="30" source="contents">
<koken:loop>
L.mapbox.featureLayer({
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [
{{ geolocation.longitude }},
{{ geolocation.latitude }}
]
},
properties: {
'title' : '{{ content.title }} <br/> <a href="{{ content.url }}">Voir la photo</a>',
'marker-size': 'large',
'marker-color': '#CC0001',
'marker-symbol': 'camera'
}
}).addTo(map);
</koken:loop>
</koken:load>
</script>
My problems are :
- I'm doing a loop to add marker after marker to the map, Is it a good method, does a loop to create a variable a better method ?
- Some images of my koken library don't have any
{{ geolocation.longitude }}
or{{ geolocation.latitude }}
and when this field is empty the map doesn't show the next markers. I tried to filter then by doing aif( ) { }
, but I failed. Like a said I'm a newbie... Could somebody show how to acheive this ? - I tried to increased the koken:load limit to 100, every thing is freaking out... any ideas ? Do I have to wait that the loop is done to continue ??
Many thanks for those who will have the goodness to help me a bit !