Hi,
you can try to use javascript in your template. Below an example (it's the
whole template, nothing cut out) I use to get different colors for my table
rows.
<script>
var idx = parseInt("[lrn]")%2;
var myClass = "tdBody" + idx;
//that should only be written for the first row
if([lrn]==1)
document.write("[provincename]<hr>");
document.write("<tr class='tblBody'>");
document.write(" <td class='" + myClass + "'>[PROJEKTNUMMER]</td>");
document.write(" <td class='" + myClass + "'>[PROJEKTBEZEICHNUNG]</td>");
document.write(" <td class='" + myClass + "'>[ART][lrn]</td>");
document.write(" <td class='" + myClass + "'>[AGNR]</td>");
document.write(" <td class='" + myClass + "'>[AG]</td>");
document.write("</tr>");
</script>
Arnd
_____
Von: [email protected]
[mailto:[email protected]] Im Auftrag von
[email protected]
Gesendet: Mittwoch, 7. April 2010 21:15
An: Daniel Morissette
Cc: [email protected]; [email protected]
Betreff: Re: [mapserver-users] record element in query header
Thanks!
Here is more details on what I need to do
Suppose I have one layer which contains the province in canada and their
cities.
When the user hover or click on a province, I want this information in a
popup or a div (the client is openlayers and I use
OpenLayers.Control.WMSGetFeatureInfo)
If the user click on the province of Quebec....
There are 2000 cities in Quebec
1: city name 1
2: city name 2
...
2000: city name 2000
So In this case I think a field name should be supported in a header
template
Perhaps I misunderstood what should be managed by the client or the server??
thanks again
Steve
Daniel Morissette <[email protected]>@lists.osgeo.org
Envoyé par : [email protected]
07/04/2010 02:16 PM
A
[email protected]
cc
Objet
Re: [mapserver-users] record element in query header
[email protected] wrote:
>
> If I put [provincename] in the template I got the value, per example
> In the Template
> [lrn]: [provincename] - [elementname]<br>
>
> The result is:
> 1: Québec - blabla 1
> 2: Québec - blabla 2
> 3: Québec - blabla 3
>
> But I don't want to put it in the template since the same information
> will be repeated.
> thanks for your help!
I'm not exactly sure if a field name should be supported in the header
template, but based on a quick browse of the code there are two other
ways you could possibly pass the information (depending on what you have
on the client side):
1- You can use parameters from the URL in a template tag. e.g. if you
pass myprov=Quebec in the URL then you should be able to use [myprov] in
your template.
2- You can reference layer-level metadata in query templates using
[metadata_...]
(Those are untested hints based on a quick browse of the source)
Daniel
--
Daniel Morissette
http://www.mapgears.com/
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users