<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Georgia;
panose-1:2 4 5 2 5 4 5 2 3 3;}
@font-face
{font-family:"Times New Roman \(Body CS\)";
panose-1:2 11 6 4 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Georgia",serif;
color:windowtext;
font-weight:normal;
font-style:normal;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:159276678;
mso-list-type:hybrid;
mso-list-template-ids:507644682 135004161 135004163 135004165 135004161 135004163 135004165 135004161 135004163 135004165;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:688214808;
mso-list-template-ids:742158496;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="en-NL" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Georgia",serif">It might be as simple as naming the template template.<b>html</b> instead of template.tmpl....<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Georgia",serif"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><i><span style="font-family:"Georgia",serif;color:black;mso-fareast-language:EN-GB">-- <o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span style="font-family:"Georgia",serif;color:black;mso-fareast-language:EN-GB">Barend Köbben<o:p></o:p></span></i></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Georgia",serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Georgia",serif"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="FR-BE" style="mso-fareast-language:EN-GB">On 17/06/2022, 10:50, "MapServer-users on behalf of Jean-Christophe Bastin" <<a href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a> on behalf
of <a href="mailto:jcbastin@thelis.be">jcbastin@thelis.be</a>> wrote:<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="FR-BE" style="mso-fareast-language:EN-GB"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span lang="FR-BE">Hello community,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I try to find how to format click results of my MapFile.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I test my WMS on QGIS. By default, infotool result looks like this :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><i><span lang="FR-BE">GetFeatureInfo results:<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-BE">Layer 'my_layer'<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-BE"> Feature 1234: <o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-BE"> field_1 = value_1<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-BE"> field_2 = value_2<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-BE"> field_3 = value_3<o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-BE"> …<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="FR-BE"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">The field names are base version coming from the data source.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I'm looking to change them in a more literal way, something like « My super field 1 has the great value 1 ».<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I found that the way to reach this is templating.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I found the documentation : <o:p></o:p></span></p>
<ul style="margin-top:0cm" type="disc">
<li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo3"><span lang="FR-BE"><a href="https://mapserver.org/mapfile/template.html#template">https://mapserver.org/mapfile/template.html#template</a><o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0cm;mso-list:l0 level1 lfo3"><span lang="FR-BE"><a href="https://mapserver.org/output/template_output.html?highlight=template">https://mapserver.org/output/template_output.html?highlight=template</a><o:p></o:p></span></li></ul>
<p class="MsoNormal"><span lang="FR-BE">And I looked for examples but I can't make it work, I was wondering what I'm doing wrong.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">Here is what I did :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I created a file "my_template.tmpl" containing just two lines :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><i><span lang="FR-BE"><!-- MapServer Template --><o:p></o:p></span></i></p>
<p class="MsoNormal"><i><span lang="FR-BE">MY TEST<o:p></o:p></span></i></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">Then, in a working Mapfile, I added the TEMPLATE to my LAYER (the file "my_template.tmpl" is stored at the same level than my MapFile) :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New"">MAP<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> LAYER<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> TEMPLATE "my_template.tmpl"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New"">END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">If I understand well, when I click to get informations, I should see now "MY TEST" ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">But it continues to display the base informations like explained above.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I also tried with OUTPUTFORMAT, but it doesn't work better :<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New"">MAP<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> OUTPUTFORMAT<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> NAME "infotool_template"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> DRIVER "TEMPLATE"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> MIMETYPE "text/html"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> FORMATOPTION "FILE=my_template.tmpl"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> LAYER<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> TEMPLATE "infotool_template"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> ...<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New""> END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="font-family:"Courier New"">END<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">I guess I do something wrong, but I can't find what.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">Missing parameter ? Simple/double cotes issue ? Bad names/references ? Or something about the client (QGIS in my case) asking informations ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">Any help/advice will be very appreciated.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">Hope to have some feedback.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">Many thanks :-)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE" style="mso-fareast-language:FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE">JCB<o:p></o:p></span></p>
</div>
</body>
</html>