Hi Paolo, <br>
<br>
Thank you very much for your help, Now it is working and I think now I
understand how do the Template work after looking at some examples and
creating 35 files even more. Here I mention some of the steps I follow
so maybe those can be helpfull for other people who probably have no
idea where to begin.<br>
<br>1. Download the last Openlayers version and copy into my folder and add a link to the Openlayers.js<br><br> <script type="text/javascript" src="OpenLayers-2.11/lib/Firebug/firebug.js"></script> <br>
<br> <script type="text/javascript" src="OpenLayers-2.11/lib/OpenLayers.js"></script><br><br>
2. I added the following code to my application in order to add the WMSGetFeatureInfo Control<br>
<br>
toolbar.addControl(new OpenLayers.Control.WMSGetFeatureInfo({<br>
url: '<a href="http://mydomain/cgi-bin/mapserv?MAP=/var/www/myaddress/mymapfile.map&">http://mydomain/cgi-bin/mapserv?MAP=/var/www/myaddress/mymapfile.map&</a>', <br>
title: 'Identify features by clicking',<br>
queryVisible: true,<br>
infoFormat:'text/html',<br>
click: 'true',<br>
layers: [DepartamentosSRMSS, Municipios, LimiteDepartamental],<br>
eventListeners: {<br>
getfeatureinfo: function(event) {<br>
map.addPopup(new OpenLayers.Popup.FramedCloud(<br>
"chicken", <br>
map.getLonLatFromPixel(event.xy),<br>
null,<br>
event.text,<br>
null,<br>
true<br>
));<br>
}<br>
}<br>
},{<br>
isDefault: true,<br>
title: 'Info'<br>
}),<br>
{<br>
iconCls: 'query',<br>
toggleGroup: 'map'<br>
});<br>
<br>
<br>
<br>
<br>
3. I Created the layers like the one below<br>
<br>
LAYER<br>
NAME 'Municipios'<br>
TYPE polygon<br>
DUMP true<br>
EXTENT 254093.5384 43485.4771 723948.4474 385070.6867<br>
CONNECTIONTYPE postgis<br>
CONNECTION "dbname='mydb' host=localhost port=5432 user='myuser' password='mypassword' sslmode=disable"<br>
DATA 'the_geom FROM "SRMSSmunici" using unique gid using SRID=-1'<br>
HEADER "templates/header.html"<br>
TEMPLATE "templates/content.html"<br>
FOOTER "templates/footer.html"<br>
METADATA<br>
'ows_title' 'SRMSSmunici'<br>
"wms_srs" "epsg:8913 epsg:4326"<br>
'ows_geometries' 'the_geom'<br>
'wms_enable_request' '*'<br>
'wms_include_items' 'all'<br>
'ows_mygeom_type' 'polygon'<br>
"wms_feature_info_mime_type" "text/html"<br>
'queryable' 'true' <br>
"wms_enable_request" "GetMap GetFeatureInfo"<br>
<br>
END<br>
STATUS OFF<br>
TRANSPARENCY 100<br>
PROJECTION<br>
"init=epsg:8913"<br>
END<br>
CLASS<br>
NAME 'SRMSSmunici' <br>
STYLE<br>
WIDTH 2.4 <br>
OUTLINECOLOR 115 0 0<br>
END<br>
END<br>
<br>
END<br><br>
<br>
4.Create the Template files <br>
<br>
Header.html<br>
<br>
<!-- MapServer Template --> <br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<a href="http://www.w3.org/TR/html4/transitional.dtd">http://www.w3.org/TR/html4/transitional.dtd</a>"><br>
<br>
<html><br>
<br>
<head><br>
<br>
<!-- enforce the client to display result html as UTF-8 encoding --> <br>
<br>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta><br>
<br>
<title>GetFeatureInfo Response</title><br>
<br>
<br>
</head><br>
<br>
<body><br>
<table><br>
<br>
<br>
Content.html<br>
<br>
<!-- MapServer Template --><br>
<br>
<br>
<caption>Layer: Arqueológico</caption><br>
<br>
<tbody><br>
<br>
<th >Nombre</th><br>
<br>
<th >Sitio</th><br>
<br>
<th >Id</th> <br>
<br>
<tr ><br>
<br>
<br>
<td >[item name="Nombre" format=$value escape=none]</td><br>
<br>
<td >[item name="Sitio" format=$value escape=none]</td><br>
<br>
<td >[item name="Id" format=$value escape=none]</td><br>
<br>
</tr><br>
<br>
Footer.html<br>
<br>
<!-- MapServer Template --> <br>
<br>
</tbody><br>
<br>
</table><br>
<br>
<br/><br>
<br>
</body><br>
<br>
</html><br><br><div class="gmail_quote">On Thu, Mar 8, 2012 at 10:27 AM, Paolo Corti <span dir="ltr"><<a href="mailto:pcorti@gmail.com">pcorti@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> But when i click on one point for example it is looking but doesn't shoe<br>
> anything and when looking at the fireburg result I found this<br>
><br>
> msWMSFeatureInfo(): WMS server error. Unsupported INFO_FORMAT value<br>
> (text/html).<br>
><br>
><br>
><br>
> I ask me if this is a problem with mapserver or with openlayers, any help<br>
> please.<br>
<br>
</div>most likely you are missing the the wms_feature_info_mime_type<br>
metadata item [1]:<br>
add "wms_feature_info_mime_type" "text/html" in the WEB/METADATA<br>
section of mapfile<br>
<br>
best regards<br>
P<br>
<br>
[1] <a href="http://mapserver.org/ogc/wms_server.html" target="_blank">http://mapserver.org/ogc/wms_server.html</a><br>
<span class="HOEnZb"><font color="#888888">--<br>
Paolo Corti<br>
Geospatial software developer<br>
web: <a href="http://www.paolocorti.net" target="_blank">http://www.paolocorti.net</a><br>
twitter: @capooti<br>
skype: capooti<br>
</font></span></blockquote></div><br><br clear="all"><br>Best regards,<br><br>Karina Guardado<br>Geoinformatic<br>El Salvador<br>