[Lift] Re: Acceding object fields in template

2009-07-22 Thread Timothy Perrett

José, im afraid it doesn't do that, you have to use explicit binds as
far as im aware. Perhaps you'll find this article on lifts binding
mechanism useful: http://is.gd/sfyT

Cheers, Tim

On Jul 22, 11:02 am, José María josemariar...@gmail.com wrote:
 Hi,

 Is it possible to access to the field of an object binded to a name in
 a template?

     bind(data , xhtml, product -- product)

 And then in the template:

    h1 id=Titledata:product.name //h1

 Thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Acceding object fields in template

2009-07-22 Thread David Pollak
Jose,

At this point, Lift doesn't support this kind of functionality... but I
think it's an interesting feature.

Can you open a ticket for it at http://github.com/dpp/liftweb/issues

Thanks,

David

On Wed, Jul 22, 2009 at 3:02 AM, José María josemariar...@gmail.com wrote:


 Hi,

 Is it possible to access to the field of an object binded to a name in
 a template?

bind(data , xhtml, product -- product)

 And then in the template:

   h1 id=Titledata:product.name //h1

 Thanks.

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

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



[Lift] Re: Acceding object fields in template

2009-07-22 Thread marius d.

Not sure how much it worths but I'm having second thoughts about this
because it feels to me like it drifts away from the Lift's templating
idiom. Accessing arbitrary objects properties/methods seems to bring
lift closer to JSF kinds of things and I don't really see what problem
this actually solves as snippet invocation.

lift:product.name /

can simply return a Text(product.name) ... or with implicit
conversions just:

def name(xhtml: NodeSeq): NodeSeq = product.name

Bringing data objects into template giving them global page scope
seems to me that it kinda opens Pandora's box.

Maybe I'm paranoiac or just wrong but that's how I see it
currently 

Br's,
Marius

On Jul 22, 6:32 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Jose,

 At this point, Lift doesn't support this kind of functionality... but I
 think it's an interesting feature.

 Can you open a ticket for it athttp://github.com/dpp/liftweb/issues

 Thanks,

 David



 On Wed, Jul 22, 2009 at 3:02 AM, José María josemariar...@gmail.com wrote:

  Hi,

  Is it possible to access to the field of an object binded to a name in
  a template?

     bind(data , xhtml, product -- product)

  And then in the template:

    h1 id=Titledata:product.name //h1

  Thanks.

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Acceding object fields in template

2009-07-22 Thread Naftoli Gugenheim

What you can do is use the overload of bind that takes a nodeFailureXform 
argument, and for that argument pass a Full function that transforms your 
nodes. Basically it will get nodes with the prefix you want, and then parse the 
label, e.g., using (Rich)String.split('.'). Use Mapper's methods to lookup the 
field, and reflection or pattern matching to get the property of the field.

-
David Pollakfeeder.of.the.be...@gmail.com wrote:

Jose,

At this point, Lift doesn't support this kind of functionality... but I
think it's an interesting feature.

Can you open a ticket for it at http://github.com/dpp/liftweb/issues

Thanks,

David

On Wed, Jul 22, 2009 at 3:02 AM, José María josemariar...@gmail.com wrote:


 Hi,

 Is it possible to access to the field of an object binded to a name in
 a template?

bind(data , xhtml, product -- product)

 And then in the template:

   h1 id=Titledata:product.name //h1

 Thanks.

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp



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