[Geoserver-users] Freemarker template design

Hi

I have created a custom content template for a GS layer and would like to have the layer title above a list of results. I am using ${type.name} as used in the examples and that works fine.

I thought that ${type.title} might work - just throws a java error saying that type.title is undefined. Do I need to define something elsewhere, or am I just using the wrong code?

Thanks
Chris

On Thu, May 8, 2014 at 8:33 AM, Chris Jackson <webturtles@anonymised.com> wrote:

Hi

I have created a custom content template for a GS layer and would like to
have the layer title above a list of results. I am using ${type.name} as
used in the examples and that works fine.

I thought that ${type.title} might work - just throws a java error saying
that type.title is undefined. Do I need to define something elsewhere, or
am I just using the wrong code?

Here is what you have in the object model given to the template, title is
not part of it:
http://docs.geoserver.org/stable/en/user/tutorials/freemarker.htm

To modify the object model given to the template some java programming
would be needed,
I can give you references to the classes involved if you are interested

Cheers
Andrea

--

Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Hi Andrea

I suppose the quick win is to start off with a better name and use something like ${type.name?replace(?capitalize} I guess!

I can see benefits to having access to both layer title and abstract in the freemarker templates, one for the future perhaps?

Cheers
Chris

···

On 8 May 2014 08:06, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Thu, May 8, 2014 at 8:33 AM, Chris Jackson <webturtles@anonymised.com> wrote:

Hi

I have created a custom content template for a GS layer and would like to have the layer title above a list of results. I am using ${type.name} as used in the examples and that works fine.

I thought that ${type.title} might work - just throws a java error saying that type.title is undefined. Do I need to define something elsewhere, or am I just using the wrong code?

Here is what you have in the object model given to the template, title is not part of it:
http://docs.geoserver.org/stable/en/user/tutorials/freemarker.htm

To modify the object model given to the template some java programming would be needed,
I can give you references to the classes involved if you are interested

Cheers
Andrea

==
Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it