[mapserver-users] html tags in GetFeatureInfo

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Fri Sep 18 03:01:49 PDT 2015


Hi,

I noticed that Sören just solved the problem but because my mail was ready I send it anyway.

We have html-formatted strings in the database and we show them through GetFeatureInfo (text/html) like this:

LAYER includes  "wms_feature_info_mime_type" "text/html" in the metadata and template is given in the CLASS
CLASS
     NAME "kalastuskielto"
     template "kalastuskielto.html"

The template "kalastuskielto.html" is like this:
 
<!-- MapServer Template -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
<title>Kalastuskieltoalue</title>
</head>
<body>
<h3>NIMI</h3>
     [item name=NIMI format="$value" escape=none]
<h3>LISÄTIEDOT</h3>
     [item name=KIELLONLISATIETO format="$value" escape=none]
<h3>VOIMASSAOLO</h3>
     [item name=VOIMASSAOLO format="$value" escape=none]
<h3>YHTEYSTIEDOT</h3>
     [item name=YHTEYSTIEDOT format="$value" escape=none]
 </body>
</html>

You can test the result from 
http://www.paikkatietoikkuna.fi/web/fi/kartta?ver=1.17&zoomLevel=9&coord=400299_6944922&mapLayers=base_35+100+default,1373+100+&&showMarker=true

Click on the red coloured river.

-Jukka Rahkonen-



-----Alkuperäinen viesti-----
Jörg Thomsen wrote:
 
> Hello Sören,

> I guess the html-tags are escaped by mapserver, try to use the raw-output:
> [attribute name],[attrribute name_esc],[attribute item name_raw] ...
> By default the attributes are encoded
> especially for HTML representation. In addition the escaped version  
>(for use in URLs) as well as the raw data is available.

http://mapserver.org/mapfile/template.html

Jörg

Am 18.09.2015 um 11:13 schrieb Horn, Sören:
> Hi,
> 
> 
> 
> I'm using the GetFeatureInfo to show some column values from a 
> database.
> 
> Everything works just fine.
> 
> 
> 
> But now I want to use html tags, such as <strong>, <em> and <br> for  
> styling my output text.
> 
> So I tried to write my content with the html syntax, like
> 
> "<strong>some-strong-content</strong><br>normal-text<em>some-emphasize
> d-text</em>",
>
>
> 
in a PostGIS column description (with datatype 'text').
> 
> 
> 
> Code snippet from my Getfeatureinfo html:
> 
> ...
> 
> <tr>
> 
> <td>Content</td>
> 
> <td>[description]</td>
> 
> </tr>
> 
> ...
> 
> 
> 
> But the GetFeatureInfo do not interpret the html tags and write the 
> exact column value (with all html tag).
> 
> 
> 
> Is there a possibility to use html tags in a PostGIS database that are 
> interpreted by MapServers GetFeatureInfo?
> 
> 
> 
> 
> 
> OS:  Debian GNU/Linux 7.8 (wheezy)
> 
> kernel: 3.2.0-4-amd64
> 
> 
> 
> MapServer: 6.4
> 
> PostGIS: 1.5
> 
> 
> 
> 
> 
> 
> 
> Best regards,
> 
> Sören Horn
> 
> 
> 
> __________________
> 
> *Landesvermessung und Geobasisinformation Brandenburg***
> 
> Dezernat 43 - GDI, Kontaktstelle, INSPIRE-Zentrale
> 
> Herr Sören Horn
> 
> Heinrich-Mann-Allee 103 - Haus 19, 14473 Potsdam
> 
> 
> 
> Mail: soeren.horn at geobasis-bb.de <mailto:soeren.horn at geobasis-bb.de>
> 
> Tel.: (03 31) 88 44 - 247
> 
> http://www.geobasis-bb.de <http://www.geobasis-bb.de/>
> 
> 
> 
> 
> 
> _______________________________________________ mapserver-users 
> mailing list mapserver-users at lists.osgeo.org 
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list