Jump to:

5554 Posts in 1742 Topics by 1227 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Easy Google Maps 'Plugin' for Silverstripe

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 9798 Views
  • MikeOne
    Avatar
    Community Member
    40 Posts

    Easy Google Maps 'Plugin' for Silverstripe Link to this post

    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.

  • MikeOne
    Avatar
    Community Member
    40 Posts

    Re: Easy Google Maps 'Plugin' for Silverstripe Link to this post

    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?

  • MikeOne
    Avatar
    Community Member
    40 Posts

    Re: Easy Google Maps 'Plugin' for Silverstripe Link to this post

    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

  • Taffy
    Avatar
    Community Member
    119 Posts

    Re: Easy Google Maps 'Plugin' for Silverstripe Link to this post

    Nice one Mike, I'm going to give it a go now.

  • MikeOne
    Avatar
    Community Member
    40 Posts

    Re: Easy Google Maps 'Plugin' for Silverstripe Link to this post

    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

  • MikeOne
    Avatar
    Community Member
    40 Posts

    Re: Easy Google Maps 'Plugin' for Silverstripe Link to this post

    Did anyone try to implement this? Any feedback for me maybe?

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Easy Google Maps 'Plugin' for Silverstripe Link to this post

    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 ?)

  • MikeOne
    Avatar
    Community Member
    40 Posts

    Re: Easy Google Maps 'Plugin' for Silverstripe Link to this post

    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.

    9798 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.