[Lift] Re: Rendering dynamic templates

2009-08-07 Thread fbettag
Do you mean the Template example? (shortened) LiftRules.snippetDispatch.append(NamedPF(Template) (Map(Template - Template)) object Template extends DispatchSnippet { def dispatch: DispatchIt = Map(show - show _) def show(in: NodeSeq): NodeSeq = { val ret:

[Lift] Re: Rendering dynamic templates

2009-08-07 Thread fbettag
hm, sorry, that one i can't figure out. Is there anything unsafe about my way? On Aug 7, 2:27 pm, fbettag fr...@bett.ag wrote: Do you mean the Template example? (shortened) LiftRules.snippetDispatch.append(NamedPF(Template) (Map(Template - Template)) object Template extends

[Lift] Re: Rendering dynamic templates

2009-08-07 Thread David Pollak
On Fri, Aug 7, 2009 at 5:27 AM, fbettag fr...@bett.ag wrote: Do you mean the Template example? (shortened) No, I mean the wiki example: http://github.com/dpp/liftweb/blob/master/sites/example/src/main/scala/net/liftweb/example/lib/WikiStuff.scala It's a SiteMap Loc that implements a full

[Lift] Re: Rendering dynamic templates

2009-08-07 Thread fbettag
I still don't understand how and where it loads its template.. i'll guess i'll stick with my comet-approach. On Aug 7, 5:28 pm, David Pollak feeder.of.the.be...@gmail.com wrote: On Fri, Aug 7, 2009 at 5:27 AM, fbettag fr...@bett.ag wrote: Do you mean the Template example? (shortened) No,

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread marius d.
Please see LiftSession.processSurroundAndInclude ... I wouldn't recommend processing templates outside normal rendering pipeline ... but for specific cases it might be ok. But what is your use case? Br's, Marius On Aug 6, 11:12 pm, fbettag fr...@bett.ag wrote: Hi there, i was just

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread Derek Chen-Becker
It might be nice to make template loading configurable. Currently, TemplateFinder is used to load templates and it, in turn, uses LiftRules.finder to locate a resource by name from the classloader. I think that we could add a layer of indirection there to allow someone to use a partial function to

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag
The CMS is my exactly my usecase. I'll try my luck with processSurroundAndInclude. On Aug 6, 11:07 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: It might be nice to make template loading configurable. Currently, TemplateFinder is used to load templates and it, in turn, uses

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag
marius, do you have any idea what i could pass lift:surround's with= attribute? On Aug 6, 11:31 pm, fbettag fr...@bett.ag wrote: The CMS is my exactly my usecase. I'll try my luck with processSurroundAndInclude. On Aug 6, 11:07 pm, Derek Chen-Becker dchenbec...@gmail.com wrote: It might

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag
def render(inContentid: String): LiftResponse = { val content = Content.find(By(Content.id, inContentid.toLong)) match { case Full(obj) = obj case _ = return NotFoundResponse() } val layout =

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag
gnaa, i had a caching problem with this one.. the problem is the first argument to processSurroundAndInclude.. still.. ;) On Aug 7, 12:47 am, fbettag fr...@bett.ag wrote:         def render(inContentid: String): LiftResponse = {                 val content = Content.find(By(Content.id,

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag
Ok the problem is in src/main/scala/net/liftweb/bultin/snippet/ Surround.scala line 36: #36 ctx.findAndMerge(S.attr.~(with), paramsMap) Here is the function which clearly needs a file to work with. u'll do the bind by hand. private[liftweb] def findAndMerge(templateName: Box[Seq[Node]],

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread fbettag
Yeah, finally i am getting better at finding this stuff out myself ;) The dirty solution is to create an empty file named empty.html templates-hidden and use this bind: val res = sess.processSurroundAndInclude( empty, bind(lift,

[Lift] Re: Rendering dynamic templates

2009-08-06 Thread David Pollak
First, you can associate a default template with a given Loc in SiteMap view the Loc.Template mechanism. Second, you can register a partial function with LiftRules.viewDispatch to render whatever dynamic content you want. Third (and this is the recommended solution for a CMS), you can use a