On Fri, Dec 5, 2008 at 1:07 AM, Tim Perrett <[EMAIL PROTECTED]> wrote:

>
> Hey guys,
>
> Some of this is a bit above my head unfortunately as im not familiar
> with lift's templating system. Let me try and clarify what i've been
> playing with so far:
>
> object DatabaseTemplateLoader {
>  def template: LiftRules.TemplatePF = {
>    case Req(page, "", _) => () => DatabaseTemplateLoader(page)
>  }
>  def apply(path: List[String]): Can[NodeSeq] = {
>    val pages = Model.createNamedQuery[Content]
> ("content.get.path.full","page" -> path.last).findAll.toList
>    if(pages.map(p => p.name) == path){
>      PCDataXmlParser(new ByteArrayInputStream
> (pages.last.body.toString.getBytes("UTF-8")))
>    } else {
>      Full(<span>NO FILE SPECIFIED</span>)
>    }
>  }
> }
>
> This works no problem, and drops in as a replacement for reading them
> off the filesystem. If my database template content has something
> like:
>
> <lift:surround with="default" at="content">
> <h1>My Content</h1>
> </lift:surround>
>
> Then the layout is rendered. However, what i want to do is grab the
> layout the user chose to use with that page and automatically use that
> (the value will is stored in the database) - this is where im getting
> confused.
>
> What would you guys suggest?


I'd suggest creating a ViewDispatchPF and adding it in using
LiftRules.appendViewDispatch

type ViewDispatchPF = PartialFunction[List[String], LiftView]

So, it's going to look a lot like your existing code.


>
>
> Cheers
>
> Tim
>
>
>
>
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
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 [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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to