On Wed, Feb 3, 2010 at 12:44 PM, Tim Maxwell <[email protected]> wrote:
> Hi folks,
>
> I am trying to do binds based on a list of products. The point is to
> create links that can be wrapped around existing text or images.
> Something like this:
>
> <signup:links.force_PROD>This is the link text our marketing dept.
> creates</signup:link>
>
> Here's what I have so far in the snippet related to it:
>
> def links(html:NodeSeq): NodeSeq={
>
> val productBinds:Seq[BindParam] = Product.findActive.flatMap{
> prod => List[BindParam] ( TheBindParam( "force_"+prod.product,
> SHtml.link("/forced?product="+prod.product, ()=>() , _ ) ) )
> }
> bind("links" , html, productBinds: _*)
>
>
It's so cool to see how people stuff in Lift...
Within your function, you can get the element that's being bound with:
BindHelpers.currentNode: Box[Elem]
On the other hand, if you're looking to get the children of the node
currently being bound:
FuncBindParam("force_"+prod.product, body => <a
href={"/forced?product="+Helpers.urlEncode(prod.product)}>{body}</a>)
Hope this helps.
Thanks,
David
> }
>
> Cheers,
> Tim
>
> --
> 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]<liftweb%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
--
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.