[Lift] Choose template in a custom Loc

2010-01-13 Thread Misha Korablin
I'm writing a custom Loc for a page and want to choose a different
template in lift:surround if a certain URL parameter is present.

Basically, I have a template like this:

lift:surround with=t1 at=content
...
/lift:surround

And at runtime I want to substitute t1 for t2 if necessary and leave
everything inside lift:surround intact.

How can I do this?


Misha
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Choose template in a custom Loc

2010-01-13 Thread Mads Hartmann Jensen
I believe you might be able to solve your problem with a snippet :) Like so;

lift:MySnippet.dynamicTemplatePicking
lift:surround dynamic:template= at=content

/lift:surround
/lift:MySnippet.dynamicTemplatePicking

and in you snippet

Class MySnippet {

def dynamicTemplatePicking(xhtml :NodeSeq) :NodeSeq = {
bind(dynamic, xhtml, AttrBindParam(template, Text(t1 or t2 
would go here), with))
}
}

Disclaimer: This code was written in mail.app and is pretty likely to contain 
errors ;) 


On 13/01/2010, at 20.37, Misha Korablin wrote:

 I'm writing a custom Loc for a page and want to choose a different
 template in lift:surround if a certain URL parameter is present.
 
 Basically, I have a template like this:
 
 lift:surround with=t1 at=content
 ...
 /lift:surround
 
 And at runtime I want to substitute t1 for t2 if necessary and leave
 everything inside lift:surround intact.
 
 How can I do this?
 
 
 Misha
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@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.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.




Re: [Lift] Choose template in a custom Loc

2010-01-13 Thread Naftoli Gugenheim
Didn't David answer your question the first time you asked it?

-
Mads Hartmann Jensenmads...@gmail.com wrote:

I believe you might be able to solve your problem with a snippet :) Like so;

lift:MySnippet.dynamicTemplatePicking
lift:surround dynamic:template= at=content

/lift:surround
/lift:MySnippet.dynamicTemplatePicking

and in you snippet

Class MySnippet {

def dynamicTemplatePicking(xhtml :NodeSeq) :NodeSeq = {
bind(dynamic, xhtml, AttrBindParam(template, Text(t1 or t2 
would go here), with))
}
}

Disclaimer: This code was written in mail.app and is pretty likely to contain 
errors ;) 


On 13/01/2010, at 20.37, Misha Korablin wrote:

 I'm writing a custom Loc for a page and want to choose a different
 template in lift:surround if a certain URL parameter is present.
 
 Basically, I have a template like this:
 
 lift:surround with=t1 at=content
 ...
 /lift:surround
 
 And at runtime I want to substitute t1 for t2 if necessary and leave
 everything inside lift:surround intact.
 
 How can I do this?
 
 
 Misha
 -- 
 You received this message because you are subscribed to the Google Groups 
 Lift group.
 To post to this group, send email to lift...@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.
 
 

-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.


-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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] Choose template in a custom Loc

2010-01-12 Thread Misha Korablin
I'm writing a custom Loc for a page and want to choose a different
template in lift:surround if a certain URL parameter is present. How
can I do this?

Misha
-- 
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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.