Up: Chapter 15

15.2 Solution

Snippets are evaluated recursively... this means that you can return markup from a snippet that contains other snippets.
The other thing to pay attention to is the <lift:embed> snippet (See ).
Combining the two:
Main page:
<html><body> Stuff here
<div class="lift:ChooseBehavior">Different behavior will go here</div>
The snippet:
object ChooseBehavior {
  def render = someState match {
    case ShowData => <lift:embed what="_showData" />
    case EditData => <lift:embed what="_editData" />
    case AjaxThing => <lift:embed what="_ajaxThing" />
Then your designer need only edit the main page and each of the templates, and then you wire them together.
Up: Chapter 15

(C) 2012 David Pollak