<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">G'day Bill,<div><br></div><div>Hopefully someone else has answered this by now...</div><div><br></div><div>On 24/02/2010, at 22:41 , <a href="mailto:mapserver-users-request@lists.osgeo.org">mapserver-users-request@lists.osgeo.org</a> wrote:<br><br><blockquote type="cite">I've been searching the 'net and asking questions here for the last two days on HTML Legends, and outside of the&nbsp;standard MS documentation (which has some very confusing bits in it for one who's unfamiliar with the way it works) I've&nbsp;not found anything relevant on this topic except my own questions echoed back at me from nabble and some&nbsp;interestingly-titled documents that are inaccessible because they were on the old MS website. And so far the forum's been&nbsp;silent on the issue as well.<br></blockquote><div><br></div><div>I think it would make a great poll, but I suspect an increased adoption of the web client packages (openlayers, geomoose etc) means less people are using these tools.</div><br><blockquote type="cite">But I have discovered one old message hinting at clever ways to use nested [if] statements with custom metadata&nbsp;variables to make a very useful layer control with collapse and expand features and more. I want to learn more about that&nbsp;but I'd like to skip the time-consuming process of learning by trial and error.<br><br>So can anyone point me to some documentation that goes into more detail about what HTML Legends can really do or&nbsp;direct me to one or two URLs that demonstrate some advanced techniques with nested [if] ...[/if] blocks and custom&nbsp;metadata variables?<br></blockquote><div><br></div>Documentation no... I used trial and error. This isn't very sophisticated,&nbsp;I'm not sure what level you are at with this. I found it very confusing to start with, and in general most users don't seem to like sites with too many checkboxes etc - so I only use them for more technical sites - defacto Web GIS. I'm also not a GIS / Web person, but an epidemiologist...<div><br></div><div>So if it helps here is an image of an example (I'm afraid the site content is internal only) and the code that generates it.</div><div><br></div><div>I have also used a site with a lot of javascript that made things visible etc with little plus + minus boxes but found that then people complained they couldn't find the layer they wanted. It's hard to win!</div><div><br></div><div>This example worked on MS 4.10, and is still working on 5.6.1 (with the security upgrades added)</div><div><br></div><div><img height="253" width="640" apple-width="yes" apple-height="yes" id="dbd210d7-c7c2-49a9-aca1-5424001fa535" src="cid:141EC98D-D6AC-49FA-A2D5-1EA5F19DF87F"></div><div><br></div><div>the mapfile bit:</div><div><br></div><div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;LEGEND</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp;STATUS EMBED</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp;position UL</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp;KEYSIZE 20 15</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp;LABEL</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp;TYPE TRUETYPE</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp;FONT arial</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp;COLOR 0 0 0</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp; &nbsp;SIZE 9</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp;END</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp; &nbsp;TEMPLATE "template_legend.html"</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px;">&nbsp;&nbsp;END</span></font></div><div><br></div><div>Note that these maps were often taken for powerpoints for situation updates, hence the legend embedded on the map as well as the legend on the side.</div><div><div><br></div><div>the lines in the template.html file that actually included it :</div><div><br></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">&lt;h2&gt;Legend:&lt;/h2&gt;<br>&lt;table width='100%'&gt;<br>&nbsp;&nbsp; &nbsp;[legend]<br>&lt;/table&gt;<br></span></font><br></div></div></div><div>and the legend_template.html template :</div><div><br></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">[leg_group_html order_metadata=leg_group_name]<br>&lt;tr&gt;<br>&nbsp;&nbsp; &nbsp;&lt;td colspan=3 class='mbg'&gt;&lt;b&gt;[leg_group_name]&lt;/b&gt;&lt;/td&gt;<br>&lt;/tr&gt;<br>[/leg_group_html]<br><br>[leg_layer_html order_metadata=layer_order opt_flag=15]<br>&lt;tr&gt;<br>&nbsp;&nbsp; &nbsp;&lt;td&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;input type=checkbox name="layer"&nbsp;<br>&nbsp;&nbsp; &nbsp; &nbsp; value="[leg_layer_name]" [if name=layer_status oper=eq value=1]CHECKED[/if]&gt;<br>&nbsp;&nbsp; &nbsp; &lt;/td&gt;<br>&nbsp;&nbsp; &nbsp;&lt;td colspan=2&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;!--a href="[metadata name=href]"--&gt;[metadata name=layer_title]&lt;!--/a--&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/td&gt;<br>&lt;/tr &gt;<br>[/leg_layer_html]<br><br>[leg_class_html]<br>&lt;tr&gt;<br>&nbsp;&nbsp; &nbsp;&lt;td width=15&gt; &lt;/td&gt;<br>&nbsp;&nbsp; &nbsp;&lt;td&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&lt;img src="[leg_icon width=150 height=75]" width=30 height=10&gt;<br>&nbsp;&nbsp; &nbsp;&lt;/td&gt;<br>&nbsp;&nbsp; &nbsp;&lt;td&gt;<br>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;[leg_class_name]<br>&nbsp;&nbsp; &nbsp;&lt;/td&gt;<br>&lt;/tr&gt;<br>[/leg_class_html]&nbsp;&nbsp; &nbsp;</span></font></div><div><br></div><div><br></div><div>I hope this helps a little bit...</div><div><br></div><div>cheers</div><div><br></div><div>Ben</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></body></html>