Allow for more than one Google Maps per page. #1291

merged 1 commit into from Apr 13, 2012


None yet

4 participants


The current Google Maps widget allows for just one map per page. Fine for most sites, but a website I'm currently building requires two (one per office) on their contact page. Hence, this amendment.


Wouldn't it be easier to add the Google Map code in a page chunk (markdown)?
At least if you only use the maps on a single page. I think the widgets should rather be used for stuff in a sidebar, which you'll see on almost every page.
And last but not least you could avoid having 2 GeoCodeer calls for each page visit.


Due to the client requiring two maps on their Contact page, the problem I had was to ensure each map's canvas element (#gmap_canvas) had a unique id.

@petsagouris petsagouris commented on the diff Apr 9, 2012
@@ -1,15 +1,23 @@
+if (isset($options["widget"])) { // for use with widget instances
petsagouris Apr 9, 2012

Maybe use something like this ?

$instance_id = '_' . ((isset($options['widget'])) ? $options["widget"]["instance_id"] : rand(2000,3000));
oldcodger Apr 9, 2012

Yes, that is more efficient, and in keeping with the ethos of PyroCMS.

@jerel jerel merged commit b0e02ef into pyrocms:2.1/develop Apr 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment