[Geoserver-users] content.ftl order of attributes mixed up
I am having a problem with attribute orders while using FTL. My sweet content.ftl file looks like this: TABLE bordercolorlight=#D7E4B2 class=table_design ALIGN=CENTER border=1 TR class=record_heading THArt/TH THLatin/TH THAreal (km2)/TH /TR #list features as feature TR class=record #list feature.attributes as attribute #if !attribute.isGeometry #if attribute.name=art_norsk TD Align=Center${attribute.value}/TD /#if #if attribute.name=art_latins TD Align=Center${attribute.value}/TD /#if #if attribute.name=km2 TD Align=Center${attribute.value}/TD /#if /#if /#list /TR /#list /TABLE It produces this getfeatureinfo for html: Art Latin Areal (km2) 6298.26717326 Bjørn Ursus arctos The feature attributes (from a shapefile) is presented in the order of the data within the shapefile (km2, art_norsk, art_latins), and not according to my content.ftl-script (art_norsk, art_latins, km2). The shapefile in question is available here: · http://db.tt/M3Nfcvbb Bug or human error somewhere on my side? http://db.tt/M3Nfcvbb Cheers, Ragnvald PS Tomorrow we will start serving geoserver wms services officially :) Senior Engineer, Environmental data section Tlf: +47 73 58 05 64 Mob:+47 92 42 15 40 The Norwegian Directorate for Nature Management www.dirnat.nohttp://www.dirnat.no -- Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World#153; now supports Android#153; Apps for the BlackBerryreg; PlayBook#153;. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev ___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] content.ftl order of attributes mixed up
On 31 October 2011 15:15, Ragnvald Larsen ragnvald.lar...@dirnat.no wrote: I am having a problem with attribute orders while using FTL. My sweet content.ftl file looks like this: ** ** TABLE bordercolorlight=#D7E4B2 class=table_design ALIGN=CENTER border=1 TR class=record_heading THArt/TH THLatin/TH THAreal (km2)/TH ** ** /TR ** ** #list features as feature TR class=record #list feature.attributes as attribute #if !attribute.isGeometry #if attribute.name=art_norsk TD Align=Center${attribute.value}/TD /#if #if attribute.name=art_latins TD Align=Center${attribute.value}/TD /#if #if attribute.name=km2 TD Align=Center${attribute.value}/TD /#if ** ** /#if /#list ** ** /TR /#list /TABLE ** ** It produces this getfeatureinfo for html: ** ** *Art* *Latin* *Areal (km2)* 6298.26717326 Bjørn Ursus arctos ** ** The feature attributes (from a shapefile) is presented in the order of the data within the shapefile (km2, art_norsk, art_latins), and not according to my content.ftl-script (art_norsk, art_latins, km2). The shapefile in question is available here: User error I'm afraid - if you want to specify the order for your output you need to loop through the attributes each time just selecting the one you want at that point. #list feature.attributes as attribute #if !attribute.isGeometry #if attribute.name=art_norsk TD Align=Center${attribute.value}/TD /#if /#if /#list #list feature.attributes as attribute #if !attribute.isGeometry #if attribute.name=art_latins TD Align=Center${attribute.value}/TD /#if /#if /#list #list feature.attributes as attribute #if !attribute.isGeometry #if attribute.name=km2 TD Align=Center${attribute.value}/TD /#if /#if /#list Ian -- Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World#153; now supports Android#153; Apps for the BlackBerryreg; PlayBook#153;. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev ___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Re: [Geoserver-users] content.ftl order of attributes mixed up
Thanks Ian, it solved the problem! But I still think that my misconception points to a pedagogical challenge here. Why did I make this mistake? · I am not very used to ftl · It works fine when the .dbf (shapefile) has the same order as it should be presented in html · I assumed that the list directive would iterate through the posts sending the attributes per post for processing as a list which could be tested. So, accepting my err there is not much else to do but to fix up a couple of ftl-scripts ☺ Cheers and thanks again! Ragnvald -- Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World#153; now supports Android#153; Apps for the BlackBerryreg; PlayBook#153;. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev ___ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users