Groovy Renderers Two ways to use Groovy in your page templates: asa Groovlet and as a GSP A) Groovlet Renderer A Roller GroovletRenderer that can evaluate a Roller template as Groovy code with Groovlet-style "out" and "html" bindings. The implementation: org.apache.roller.scripting.GroovletRenderer org.apache.roller.scripting.GroovletRendererFactory org.apache.roller.scripting.GroovyRollerBinding Here's an example Hello World template: println "Hello World" Here's an example template that displays recent entries from a weblog: html.html { // html is implicitly bound to new MarkupBuilder(out) head { title(model.weblog.name) } body { h1(model.weblog.name) i(model.weblog.description) map = model.getWeblogEntriesPager().getEntries(); map.keySet().each() { map.get(it).each() { h2(it.title) p(it.text) br() } } } } B) GSP Renderer A Roller GSPRenderer that can evaluate a Roller template as a Groovy Template with GSP-style "out" and "html" bindings. The implementation: org.apache.roller.scripting.GSPRenderer org.apache.roller.scripting.GSPRendererFactory org.apache.roller.scripting.GSPRollerBinding Here's an example Hello World template: <%= "Hello World" %> Here's an example template that displays recent entries from a weblog: ${model.weblog.name}

${model.weblog.name}

${model.weblog.description} <% map = model.getWeblogEntriesPager().getEntries(); map.keySet().each() { %> <% map.get(it).each() { %>

${it.title}

${it.text}


<% } }%> To use these renderers in Roller: 1) Put roller-groovy.jar and groovy-all-1.5.4.jar in WEB-INF/lib 3) In your roller-custom.properies file add this override: rendering.rollerRendererFactories=\ org.apache.roller.ui.rendering.velocity.VelocityRendererFactory,\ org.apache.roller.scripting.GroovletRendererFactory,\ org.apache.roller.scripting.GSPRendererFactory,\ 4) Restart Roller 5) Create a new Weblog Page Template and set Template Language to either "groovlet" or "gsp". 6) In your page template you'll have access to all normal Roller models plus the name "out" will be bound to a Writer that you can use for output. Also, the name "html" will be bound to a markup builder.