its not working now and i don't know why.

On 11月17日, 上午11時13分, philip <[email protected]> wrote:
> Hi Thiebaut,
>
> Thanks.
>
> So for a 4 level page system I do.
>
>    LiftRules.rewrite.prepend(NamedPF("inner pages")
>    {
>      case RewriteRequest(ParsePath(List("page", level1), _, _,_), _,
> _) =>
>        RewriteResponse("page" :: Nil, Map("level1" -> level1))
>      case RewriteRequest(ParsePath(List("page", level1, level2), _,
> _,_), _, _) =>
>        RewriteResponse("page" :: Nil, Map("level1" -> level1, "level2"
> -> level2))
>      case RewriteRequest(ParsePath(List("page", level1, level2,
> level3), _, _,_), _, _) =>
>        RewriteResponse("page" :: Nil, Map("level1" -> level1, "level2"
> -> level2, "level3" -> level3))
>      case RewriteRequest(ParsePath(List("page", level1, level2,
> level3, level4), _, _,_), _, _) =>
>        RewriteResponse("page" :: Nil, Map("level1" -> level1, "level2"
> -> level2, "level3" -> level3, "level4" -> level4))
>    })
>
> Is the above code ok? works for me - goes to page.html. I'm still a
> beginner at Scala/Liftweb.
>
> I am thinking that later I may want my template to be different based
> upon the URL. So in that case I will need to make a function which
> returns a RewriteResponse and place the function in the above. I will
> be able to work out the template based upon database contents, queried
> by the path.
>
> I don't really need more then 4 levels deep path.
>
> Philip
>
> On 11月16日, 下午10時30分, Thiébaut Champenier <[email protected]>
> wrote:
>
>
>
> > Hi Philip,
>
> > Just add something like that to your Boot.scala
>
> >     // Rewrite some URLs
> >     LiftRules.rewrite.prepend(NamedPF("test rewrite") {
> >       case RewriteRequest(ParsePath(List("test", stuff1, stuff2), _, _,_),
> > _, _) =>
> >         RewriteResponse("test_page" :: Nil, Map("stuff" -> stuff1,
> > "other-stuff" -> stuff2))
> >     })
>
> > The page test_page will then receive parameters, get them via
> > S.param("stuff").
> > It’s better not to name your page the same as the URL path fragment ("test")
> > to avoid looping rewrites.
> > Adapt the pattern matching and the RewriteResponse to your parameters.
>
> > Hope it helps,
>
> > Thiébaut- 隱藏被引用文字 -
>
> - 顯示被引用文字 -

--

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