This looks promising! Will do.

Thanks,
Chas.

Derek Chen-Becker wrote:
> You should be able to do that with a combination of bind and 
> chooseTemplate. For instance, your template could look like:
> 
> ...
> <lift:MySnippet.categories>
> <h1>Categories</h1>
> 
> <categories:entries>
>   <category:name/>
>   <category:links>
>     <link:name/>
>   </category:links>
> </categories:entries>
> </lift:MySnippet.categories>
> 
> And then your code would look like:
> 
> val categories = ...
> 
> val catEntries : NodeSeq = categories.flatMap({category =>
>   val linkEntries : NodeSeq = category.links.flatMap({link =>
>     bind("link", chooseTemplate("category", "links"), "name" -> 
> Text(link.name <http://link.name>)
>   })
> 
>   bind("category", chooseTemplate("categories", "entries"),
>        "name" -> Text(category.name <http://category.name>),
>        "links" -> linkEntries)
> })
> 
> bind("categories", xhtml, "entries" -> catEntries)
> 
> 
> Make sense?
> 
> Derek
> 
> On Thu, Oct 23, 2008 at 6:41 PM, Charles F. Munat <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
> 
>     I have a group of links that are assigned to categories.
> 
>     I want to pull the links and categories down and output them like this:
> 
>     Category A
>       Link 1
>       Link 2
> 
>     Category B
>       Link 3
> 
>     ...
> 
>     Is there a way to do this with bind, or should I just build the XHTML in
>     the snippet?
> 
>     Thanks!
>     Chas.
> 
> 
> 
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to