h1. PlayRythm module documentation

Welcome to PlayRythm module documentation. This documentation is intended for the *0.9 beta release* and may significantly differ from previous module version's documentation.

Check the "version history":history.

h2. PlayRythm features

PlayRythm is yet another template engine plugin for Play!Framework 1.2x version:

# Static and strong typed pure Java template. Yes it's like Japid and Jamon
# Razor like syntax
# Transparently integrated with Play!Framework. Just follow what you did with Groovy template is okay, no RythmController, no rythmview. Think PlayRythm as an unobtrusive Japid.
# Support layout and tag, as you did in Groovy template
# Support FastTags and JavaExtensions with constraints

h2. Template Syntax at a glance

Based on Rythm template engine, PlayRythm module provides an easy to read/write template language which is very like that is used in .Net MVC's "Razor template engine":http://razorengine.codeplex.com/. Here is one rythm template example:

bc. @extends(/main.html);
@args List<User> users;
...
<ul>
@for(User user: users) {
    @if (!user.disabled()) {
        <li class="@user_parity">
            <span>@user_index</span>
            <a href="@_u(User.show(user.getId()))">user.getName()</a>
        </li>
    }
}
</ul>

h2. Use PlayRythm template engine

h3. 1. Add PlayRythm into your @dependencies.conf@ file:

bc. # Application dependencies
   require:
       - play -> rythm

h3. 2. Process your controller action method:

bc. @UseRythmTemplateEngine public static void list() {
    List<User> users = User.findAll();
    render(users);
}

So as you can see, you don't need to rewrite your existing controller action methods, just annotate it with <code>@UseRythmTemplateEngine</code> is enough. PlayRythm will shortcut template loading process and process the template rendering before Play's default groovy template engine activated.

You can also annotate <code>@UseRythmTemplateEngine</code> on Controller class declaration, which mark all action methods inside this controller to be processed by PlayRythm template engine.

p(note). If you set @rythm.default.engine=rythm@ in your @application.conf@ file, then you don't need <code>@UseRythmTemplateEngine</code> annotation because all your templates will be processed by PlayRythm by default unless you have annotated <code>UseSystemTemplateEngine</code> to your controller class or action methods, which explicitly indicate the relevant rendering request shall not be processed by PlayRythm and leave it to Play's built-in template engine.

h3. 3. Write your view or port your existing view using Rythm syntax.

This might be the hardest part but not that hard as almost all Groovy template's keywords or facility has corresponding part provided by Rythm template engine. Please refer to "Rythm Template User Guide":user_guide for more information

h2. <a name="resource">See Also</a>

# %(next)"Integrate PlayRythm into your Play project":integration%
# "User's guide":user_guide
# "Reference manual":reference
