5099 Posts in 1519 Topics by 1116 members
| Go to End | Next > | |
| Author | Topic: | 8119 Views |
-
Easy Google Maps 'Plugin' for Silverstripe

9 October 2009 at 12:42am Last edited: 9 October 2009 12:43am
Hi all,
First of all, great product!
For a customer, I was looking for a simple way to allow content editors to easily add a Google Map so they could include this on any page they'd like - for example - on a 'Contact Us' page or so. I have been looking around on this forum, but really couldn't find anything that was easily implementable by someone without any technical knowledge what-so-ever (my customer).
I'm seeing the addition of a simple Google map as a content thing so I didn't want to create a Silverstripe Module that created a new Page Type as the editors needed the flexibility to add a map to any page type / content. Keeping this in mind, I decided to have a go at adding an 'insert Google Map' button to the CMS TinyMCE editor.. this seemed to make the most sense. This also opened up a whole can of worms as the editor does not allow you to add a script block to the content (I would have to hack core ss files to make this possible). I therefore came up with a 'Progressive Enhancement' solution which basically means that TinyMCE adds a Div with some additional information about the map to show - and that a script is loaded that finds out if the current page has a googlemap-div and if yes - loads the appropriate script libraries and creates the map on the fly. This also means that the actual map is not shown in the content pane of the CMS (it just shows a grey placeholder div).
I have a BETA version of this 'plugin' (no use calling it a module) available for anyone who would like to have a go at this thing or thinks they could use this functionality. It should be completely theme independent. Once a map has been added to the content, you should be able to change themes in _config.php and the map will (should) still work without any additional configuration.
The zipped files + (simple) installation instructions are available for download at http://www.europehosting.com/download/Google-Maps-v0.1beta.zip
The installation should take about 2 minutes max ;-) I kept it as simple as possible and prevented having to touch Core silverstripe stuff.
Any feedback/suggestions appreciated!
Best Regards,
Mike. -
Re: Easy Google Maps 'Plugin' for Silverstripe

9 October 2009 at 2:45am Last edited: 9 October 2009 2:46am
Please note - the script will fail in Blackcandy, due to the fact that the themes includes a lot of other libraries (like prototype) to support the search box in this theme and those libs seem to be clashing with jQuery.
Not sure how to fix this savely as running jQuery in noConflict() doesn't really resolve things either..
I'll see if I can find a way to NOT use jQuery maybe?
-
Re: Easy Google Maps 'Plugin' for Silverstripe

9 October 2009 at 3:54am
The jQuery issue has now been resolved (it seems) - implemented noConflict() and that does seem to do the trick. Now also works in blackcandy for me..
download: http://www.europehosting.com/download/Google-Maps-v0.2beta.zip
-
Re: Easy Google Maps 'Plugin' for Silverstripe

9 October 2009 at 3:58am
Nice one Mike, I'm going to give it a go now.
-
Re: Easy Google Maps 'Plugin' for Silverstripe

9 October 2009 at 4:48am
Cool - it would be great if you can provide some feedback. BTW - this hasn't been tested fully in a lot of browsers so if you encounter any issues, please let me know the browser (+version) as well.
To see the output of the plugin (i.e. what does it do on your website) you could have a look at http://ss.kikkert.nl
-
Re: Easy Google Maps 'Plugin' for Silverstripe

15 October 2009 at 11:27pm
Did anyone try to implement this? Any feedback for me maybe?
-
Re: Easy Google Maps 'Plugin' for Silverstripe

16 October 2009 at 8:17am Last edited: 16 October 2009 8:18am
Hey Mike...
Very elegant solution, will definitely try it out somewhere next week !
Good to see there's another Silverstripe convert (to be) in The Netherlands. Told ya' those kiwi's were on to something... ;)
ps(Beers next week ?)
-
Re: Easy Google Maps 'Plugin' for Silverstripe

16 October 2009 at 10:54am
Yep - you would have to travel quite far to get the right CMS - but it's worth it!
Anyhoe, let me know how you get on.. I've uploaded a new version as I found a check was missing in the v0.2 one causing it to fail in certain circumstances. The new one can be downloaded at http://www.europehosting.com/download/Google-Maps-v0.3beta.zip
Beer sounds excellent!
Speak soon,
Mike.
| 8119 Views | ||
| Go to Top | Next > |



