SnipSnap has internal support for
Groovy scripting. Currently snips can be made to behave like groovy templates similar to JSP pages. This can be used to get a rendered snip only without the surrounding portlets:
Don't try here at SnipSnap.org as this feature can only be activated if you are the admin of a SnipSnap server
Pure Rendered Snip Content (HTML)
<%
if(view != null) {
println( org.snipsnap.snip.SnipSpaceFactory.getInstance().load(view).getXMLContent());
}
%>
- Lock the Snip (can only be done by Server Admins and Editors)
- Add a TypeLabel to PureRenderedSnip with type "text/gsp"
- After saving the label, edit the same Label again
- Select PureRenderedSnip as view handler
Now the Snip (the script) acts as its own view handler and should show nothing when viewed without an argument. Append an argument to the Snips URL to view the result:
Example:
http://snipsnap.org/space/snipsnap-documentation/PureRenderedSnip?view=SnipSnapWhich shows the snip "SnipSnap" instead of the script. Now that this works, we can use this script to only get the rendered HTML of any snip we want by using the plugin feature of
SnipSnap:
Example:
http://snipsnap.org/plugin/snipsnap-documentation/PureRenderedSnip?view=SnipSnapNow you get the snips rendered HTML only.
For More Information:
see my (
jsawers)
SnipSnap and Groovy Tips