El jue, 19-01-2006 a las 15:48 +0000, Ross Gardler escribió:
> Thorsten Scherler wrote:
> > El jue, 19-01-2006 a las 00:14 +0000, Ross Gardler escribió:
> >
> >>More "simple" questions about the Dispatcher. Like David I'll turn the
> >>responses into a doc:
> >>
> >
> >
> > The only problem: David is not Mr. Confusion. ;-)
> >
> >
> >>I am doing some work on the listLocations plugin. I need to integrate
> >>Google Maps so that I get a mini-map for each of the entries in a file.
> >>
> >>Here is a sample of the code that I need to output. Can someone tell me
> >>what my contract should look like. The part that confuses me is the fact
> >>that I need to add content into the head as well as the body:
> >>
> >><html xmlns="http://www.w3.org/1999/xhtml">
> >> <head>
> >> <script src="http://maps.google.com/maps?file=api&v=1
> >>
> >> &key=ADD_YOUR_KEY_HERE" type="text/javascript">
> >> </script>
> >> </head>
> >> <body>
> >> <div id="map" style="width: 400px; height: 300px"></div>
> >> <script type="text/javascript">
> >> //<![CDATA[
> >> var map = new GMap(document.getElementById("map"));
> >> map.centerAndZoom(new GPoint(-83.022206, 39.998264), 3);
> >> //]]>
> >> </script>
> >> </body>
> >></html>
> >>
> >
> > Hmm, sorry, before I can answer this I need to know which version (v2 or
> > v3)?
>
> v2 until v3 stabalise.
>
> > Second: Do you use the contract more then once in the structurer? Or
> > will it be used only once per structurer?
>
> Impossible to say in advance since I don't know all the potential use
> cases of the contract.
>
> In my specific use case I will only use it the once.
>
ok,
<forrest:contract name="siteinfo-google-map">
<forrest:properties contract="siteinfo-google-map">
<forrest:property name="siteinfo-google-map-key">
ADD_YOUR_KEY_HERE
</forrest:property>
</forrest:properties>
</forrest:contract>
and the contract:
<xsl:template name="siteinfo-google-map-head">
<xsl:param name="siteinfo-google-map-key" select="'test'"/>
<script src="http://maps.google.com/maps?file=api&v=1
&key={$siteinfo-google-map-key}" type="text/javascript">
</script>
</xsl:template>
<xsl:template name="siteinfo-google-map-body">
<div id="map" style="width: 400px; height: 300px"></div>
<script type="text/javascript"> //<![CDATA[
var map = new GMap(document.getElementById("map"));
map.centerAndZoom(new GPoint(-83.022206, 39.998264), 3);
//]]> </script>
</xsl:template>
HTH
salu2
--
thorsten
"Together we stand, divided we fall!"
Hey you (Pink Floyd)