I have a page which is passed an id from which the content is determined. What I’m looking to do is dynamically replace the pages “chrome” depending on the content.
So if I have a db record “Book”, I’d like to display the Book chrome in templates-hidden.
Thanks for any help, much appreciated 🙂
You can define a snippet that selects the template you want and pass the xhtml NodeSeq containing the template selection to it:
And the snippet code:
By changing the
"default"inText("default")inside the snippet you can choose another template depending on your needs. Maybee you want to do something likedef choose (record: Record) = record match { case b: Book => "booktemplate"}and so on…Source: Mads Hartmann’s posting