Alex Black <[email protected]> writes:

> For example, if my html template looks like this:
>
> <lift:surround with="default" at="content">
>               <h2>foobar</h2>
>                 <lift:MySnippet.render>
>                 <img src="dummy"/>
>                 </lift:MySnippet.render>
> </lift:surround>
>
> In my snippet I'd like to replace "dummy" (in img src) with a real
> value.  I'm sure there are other ways to output img tags with
> attribute values, but I'm specifically interested in this general
> case: writing the presentation in the template, and filling in the
> attribute value from code.

Use AttrBindParam and prefix the attribute with the bind point

Template:
      <td values:rankClass=""><values:tco/></td>
        

Code:
                 bind("values", in, 
                      BindNumber("tco", res.filteredResult(lc).avgTCO(segment)),
                      
AttrBindParam("rankClass",Text(rankClass(res.rankBySegment(lc, segment))), 
"class")
                 )

This will render
 <td class="something">42</td>

/Jeppe

--

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=.


Reply via email to