Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

googlemaps api 2.5 html

Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
Smarty Rookie

Joined: 21 Mar 2007
Posts: 6

PostPosted: Thu Jan 10, 2008 9:35 am    Post subject: googlemaps api 2.5 html Reply with quote


I am using the api quite a while now and I have a bit over 500 markers on my entire map.

The load time is pretty long now so I made a select by country, and I am trying to reduce the html in the createmarker().

The question is what is the use of all the backslashes in the html code ?
because this is making the html almost double...


var marker = createMarker(point,"Bicross Club Soumagne","<div class=\"infowindow\"><div class=\"flag\"><img src=\"\/nucleus\/plugins\/googlemaps\/flags\/be.gif\" alt=\"\" \/><\/div><h2><a href=\"http:\/\/\/item\/bicross-club-soumagne\">Bicross Club Soumagne<\/a><\/h2><b><ul><li><a onclick=\"zoomMarker(16);\" title=\"Zoom In\"><img src=\"\/images\/zoom.gif\" alt=\"\"><\/a><\/li><li><a onclick=\"zoomMarker(2);\" title=\"Zoom Out\"><img src=\"\/images\/zoom-out.gif\" alt=\"\"><\/a><\/li><\/ul>Details<\/b><p>No details available yet. If you are the spot\/track owner or a local rider who wants to add info of this spot, please contact us.<\/p><p><b id=\"f\">Features<\/b><table><tr><td><img src=\"\/images\/starthill.gif\" alt=\"\" onmouseover=\"f('Starthill with start gate.');\" onmouseout=\"f('Features');\" \/><\/td><\/tr><\/table><\/p><\/div>", 84,"Bicross Club Soumagne","BE");

Ok i've found it, a bit logic actually.
But I've found a better way, instead of escaping the " double quotes and slashes, you can better escape the ' single quotes.

this is my result:

var marker = createMarker(point,'Bicross Club Soumagne','<span><img src="/nucleus/plugins/googlemaps/flags/be.gif" alt="" /></span><h2><a href="/item/bicross-club-soumagne">Bicross Club Soumagne</a></h2><b><ul><li><a onclick="zoomMarker(16);" title="Zoom In"><img src="/images/zoom.gif" alt=""></a></li><li><a onclick="zoomMarker(2);" title="Zoom Out"><img src="/images/zoom-out.gif" alt=""></a></li></ul>Details</b><p>No details available yet. If you are the spot/track owner or a local rider who wants to add info of this spot, please contact us.</p><p><b id="f">Features</b><table><tr><td><img src="/images/starthill.gif" alt="" onmouseover="f(\'Starthill with start gate.\');" /></td></tr></table></p>','84','Bicross Club Soumagne','BE');

742 characters long instead of 902

I also put the <div class="infowindow"> in the createMarker function itself instead of outputting it for every marker.

160 characters less for every marker isn't bad, if you multiply that with 500 markers Very Happy

Hope this will help someone with the same problem.

Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP