[mapserver-users] Conditions in Query Templates
Steve Lime
Steve.Lime at dnr.state.mn.us
Tue Apr 21 09:36:42 PDT 2009
You've got a couple of options:
1) use javascript, that is, assign the value for installer to a variable and then do a conditional display, e.g.
<script ..>
var installer = '[installer]';
if(installer) document.write(...);
</script>
2) use an [item ...] tag
[item name="installer" pattern="." format="<table><tr><td>Installer:</td><td>$value</td></tr></table>"]
This should output the table if the installer column has data in it.
Steve
>>> On 4/21/2009 at 11:28 AM, in message
<9D57091E0FAA0F4D9E75E148B5CEEC264CFB886574 at KENAI.amr.ch2m.com>,
<Grant.McKenzie at CH2M.com> wrote:
> A question regarding MapServer Query Templates.
>
> Is there away to put conditions into a MapServer query template (when you
> click on a feature, send a wfs request and attempt to format the results)?
>
> My template looks like this:
>
> <table>
> <tr>
> <td>Installer: </td>
> <td>[installer]</td>
> </tr>
> </table>
>
> What I would like to do is only show the installer ROW if the installer
> result info is not empty. So I'd like to wrap it in some type of IF
> statement. Is it possible to do this directly in the query template, or does
> this need to happen earlier in the process?
>
> A quick note: my data is sitting on MySQL (long, lat), being served via MS4W
> 2.3.1.
>
> Thanks.
>
> Grant McKenzie
More information about the MapServer-users
mailing list