Recursive blocks in Scala Play Framework templates?

Up vote 2 down vote favorite 2 share g+ share fb share tw.

I'm writing a template for a blog post, which has threaded comments. A natural way of writing a template for threaded comments it use a recursive way for constructing the Html. Something like this: @showComment(comment: models.

Comment) = { by @comment. Author, @comment.postedAt. Format("dd MMM yy") Detail: @Html(comment.content.

Replace("\n", "")) Reply @comments filter { c => c. Parent_id == comment. Id } map { c => @showComment(c) } } The problem is that using a recursive block yields the error: Error raised is : recursive method showComment needs result type If I try to put a return type in the showComment it raises this errror: Error raised is : not found: value showComment Any workaround?

Scala playframework threaded-comments link|improve this question asked Oct 9 '11 at 21:32Felipe Hummel697413 50% accept rate.

I don't know much (more like nothing) about the Play Framework but try: @showComment(comment: models. Comment):Node = { by @comment. Author, @comment.postedAt.

Format("dd MMM yy") Detail: @Html(comment.content. Replace("\n", "")) Reply @comments filter { c => c. Parent_id == comment.

Id } map { c => @showComment(c) } }.

It seems play templates do not allow to set return types. And as a consequence no recursion at all. – Felipe Hummel Oct 10 '11 at 0:28 @FelipeHummel Seems limiting.

What if you return a play.template. Html instead of a Node? – Daniel Hinojosa Oct 10 '11 at 1:13 same error: "Error raised is : not found: value showComment" =\ – Felipe Hummel Oct 10 '11 at 1:37.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions