My suggestion is the same as before, use OUTPUTFORMATs. You can define a JSON
format and a HTML format and process the same layer through both, including
simple joins. The exception here is if you're doing one-to-many joins where the
join itself requires a template. In that case you're stuck because there is no
way to specify multiple templates for a one-to-many join. Wait! Actually you
can, you just have to define the join multiple times, one for JSON and one for
HTML - it's inefficient though.
The key here is that you're basically abandoning the TEMPLATE keyword at the
layer level. Instead you do:
OUTPUTFORMAT
NAME 'json'
DRIVER 'TEMPLATE'
MIMETYPE 'application/json'
FORMATOPTION "FILE=templates/json.tmpl"
FORMATOPTION 'ATTACHMENT=mapserver.json'
END
OUTPUTFORMAT
NAME 'html'
DRIVER 'TEMPLATE'
MIMETYPE 'text/html'
FORMATOPTION "FILE=templates/html.tmpl"
FORMATOPTION 'ATTACHMENT=mapserver.html'
END
In your layer you'd have:
TEMPLATE void
just to make the layer queryable.
If you're using the CGI you'd use queryformat=json or queryformat=html to
switch between them. With WFS/WMS I believe you have to reference the mime type.
Please let me know if you have more questions. This can work well. I have
several apps that return JSON, GEOJSON or HTML with a single layer.
Steve
________________________________
From: mapserver-users <[email protected]> on behalf of
pe_lord <[email protected]>
Sent: Thursday, April 27, 2017 6:48:13 AM
To: [email protected]
Subject: Re: [mapserver-users] Multi template
Any another hint to maintain 2 template on same layer?
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Multi-template-tp5317599p5318595.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapserver-users