Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » ZoomIn API

Our old forums are still available as a read-only archive.

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

Page: 1 2
Go to End
Author Topic: 2502 Views
  • gakenny
    Avatar
    Community Member
    153 Posts

    ZoomIn API Link to this post

    Hello,

    Just working on our first website for SilverStripe. Is there a way to incorporate the ZoomIn API on our website? We want to include a map to the location for visitors.

    Sample code (Javascript) is found here:
    http://developer.zoomin.co.nz/example/map_v4/example1

    Cheers,

    Gary

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: ZoomIn API Link to this post

    Include the JavaScript file, and script it, as you would in a static HTML application... Not really much to it.

    You might want to look at using the template tags inside a script tag to load data from the database

    <script>
    <% control Places %>
    someZoominFunction('$Title', '$OtherVal');
    <% end_control %>
    </script>

  • gakenny
    Avatar
    Community Member
    153 Posts

    Re: ZoomIn API Link to this post

    Thanks Sam...

    I am warming up to this again... I presume that I create a Maps type and use a template to format this and pass parameters from the page definition in the CMS.

    Is this correct?

    Cheers,

    Gary

  • gakenny
    Avatar
    Community Member
    153 Posts

    Re: ZoomIn API Link to this post

    Hello,

    I had a go at this last night and it was relatively simple to get working. I created a MapHolder and a MapPage type that contains the location coordinates and description. I created a MapPage template and this contains the relevant JavaScript with the placeholders for the fields to insert from the table.

    The only hurdle I have encountered is that the map displays as blue in Firefox (although it displays in IE 6 & 7 fine). Inserting the JavaScript into a static page displays correctly on all browsers. Removing the stylesheets so that these are not applied to the pages does not resolve the issue.

    Has anyone else encountered such an issue?

    Cheers,

    Gary

  • gakenny
    Avatar
    Community Member
    153 Posts

    Re: ZoomIn API Link to this post

    Hello,

    I have contacted the ZoomIn developers regarding the issue where a static page containing the HTML generated by SilverStripe works but the dynamically generated GTML does not. This was the reply:

    Hmmm, tricky. I don't know much about how SilverStripe works, but there are
    two differences between the page source of the SilverStripe version and the
    static version you pasted: the former starts with an XML tag (<?xml
    version="1.0" encoding="UTF-8"?>), and the html tag include xml namespace
    attributes (<html xmlns="http://www.w3.org/1999/xhtml lang="en" >).

    Looking at the way the syntax is highlighted in the two versions by
    Firefox's source viewer, I'd surmise that those changes are causing Firefox
    to parse the CDATA block (containing our script) in a different way, which
    causes an error (not a very meaningful one: "An invalid or illegal string
    was specified"). Is there any way that you can configure SilverStripe to not
    make those XML settings?

    Can anyone assist with this?

    Cheers,

    Gary

  • Markus
    Avatar
    Google Summer of Code Hacker
    152 Posts

    Re: ZoomIn API Link to this post

    Maybe this thread could help you..

  • gakenny
    Avatar
    Community Member
    153 Posts

    Re: ZoomIn API Link to this post

    Hi Markus,

    Thanks for the reply. I removed the code from the default template as indicared by ZoomIn and this addressed the issue. Is this an issue that I should address with ProjectX and what would I tell them they should change?

    I guess by removing this code, the generated code is no longer fully compliant.

    Cheers,

    Gary

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: ZoomIn API Link to this post

    It's still compliant, but it's compliant HTML 4.01 instead of compliant XHTML. Strictly speaking, IE doesn't support XHTML and most browsers interpret XHTML provided to them as HTML 4.01.

    If you want to raise this with the Zoomin team - you want to mention to them that their code doesn't work if the XHTML page is sent with the text/html content type. JavaScript behaviour on this is a little different, particularly around &nbsp; and .innerHTML.

    2502 Views
Page: 1 2
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.