On Wed, May 20, 2009 at 8:38 PM, fatu <[email protected]> wrote:

>
> Hi David,
>
> yes it will do, thank you so much for such a lightning-fast
> development in reply!
>
> I'm only thinking about a case that is probably much more of an
> exception than a rule, i.e. when the snippet dynamically decides if it
> needs to generate a full page or a fragment (which is not a very good
> design anyway IMHO), for example based on some info passed. But even
> in that case the snippet will know that and will be able to set
> S.skipDocType = true accordingly, so it should be perfectly fine. Plus
> it won't be difficult at all to make the processing diverge in the 2
> cases by using URL rewrites, redirecting it to a different template /
> snippet depending on parameters or URL structure, which is probably a
> better design too.
>

You could also pass a header flag from your AJAX call.  If the header's set,
you don't do the boilerplate surround that'll include all the <html>, <head>
and <body> tags.

Anyway, enjoy and thanks for the use case.

Party on.


>
> Again many thanks everyone and David especially!
>
> On May 20, 4:05 pm, David Pollak <[email protected]>
> wrote:
> > I'm about to commit S.skipDocType = true | false.  If you set it to true,
> > the <!DOCTYPE .../> will be omitted from the response page.  This will
> allow
> > your AJAX fragements to pull parts of pages from the server.  Note that
> > someplace in your snippets, you'll have to set S.skipDocType = true.
> >
> > Does this address your issue?
> >
> >
> >
> > On Wed, May 20, 2009 at 5:13 AM, fatu <[email protected]> wrote:
> >
> > > Hi Marius,
> >
> > > as I understand them, Jx classes help in generating JS that can itself
> > > generate DOM at the client.  Am I wrong? I'd really like to serve back
> > > an HTML fragment built by using the normal Lift template pipeline (so
> > > including surround & bind). Is that possible?
> >
> > > Thanks
> >
> > > On 20 Mag, 13:16, "marius d." <[email protected]> wrote:
> > > > As I understood you want to make an Ajax request and serve back a
> > > > Document Fragment. If so please also take a look at Jx stuff. We
> > > > discuss Jx classes in a fairly amount of details in the lift book.
> >
> > > > Br's,
> > > > Marius
> >
> > > > On May 20, 9:32 am, fatu <[email protected]> wrote:
> >
> > > > > Timothy,
> >
> > > > > thanks for the links, I found them useful and I find your blog in
> > > > > general very interesting. Came across scala-blogs.org and it looks
> > > > > quite promising as well.
> >
> > > > > I knew "bind" already from the "Exploring Lift" book which I pull
> from
> > > > > git, build with Lyx and keep at hand regularly. In the doctype
> post,
> > > > > though, I couldn't find a way to specify "no doctype"  which I
> think
> > > > > is necessary to serve a fragment; plus I couldn't find any other
> easy
> > > > > "out-of-the-box" way to do it. Shouldn't this use case (serving
> > > > > fragments), which I think is quite common, be better / more easily
> > > > > supported by the framework? Can someone post an example of how to
> do
> > > > > it with raw response handling in the meanwhile?
> >
> > > > > Thanks anybody.
> >
> > > > > Fabio
> >
> > > > > On 26 Apr, 21:49, Timothy Perrett <[email protected]> wrote:
> >
> > > > > > George,
> >
> > > > > > To tell lift what doctype you want to use see my blog post here:
> > >http://is.gd/uJ4L
> >
> > > > > > Also, you'll want to read another one of my posts in which I
> discuss
> > > > > > the bind(...) method and how you can stop putting markup into
> your
> > > > > > snippets:http://is.gd/sfyT
> >
> > > > > > Cheers, Tim
> >
> > > > > > On Apr 26, 1:02 pm, george <[email protected]> wrote:
> >
> > > > > > > hello all,
> >
> > > > > > > hopefully someone can help me out here.
> >
> > > > > > > i am trying to port some simple ajax stuff over to lift from a
> > > rails
> > > > > > > app. basically it just loads anhtmlfragmentand puts it into the
> dom
> > > > > > > using prototype.
> >
> > > > > > > i have set up a template which contains thefragmentat src/main/
> > > > > > > webapp/fragment.html
> >
> > > > > > > <ul><li>item</li></ul>
> >
> > > > > > > then i made the page available using the SiteMap and all seems
> > > good,
> > > > > > > but here comes the problem
> >
> > > > > > > the lift response adds the xml declaration and doctype, one of
> > > which
> > > > > > > seems to cause prototype some problems
> >
> > > > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > > > <!DOCTYPEhtmlPUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> > >http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > > > > <ul><li>item</li></ul>
> >
> > > > > > > so the question is, how can i make lift send back the
> > > rawhtmlwithout
> > > > > > > meddling with it?
> >
> > > > > > > i have tried out using ResourceServer to serve it statically
> which
> > > > > > > works, but this wouldn't allow me to generate thefragment
> > > > > > > dynamically.
> >
> > > > > > > i would also prefer to have a separatehtmltemplate file rather
> than
> > > > > > > embedding the markup code in a snippet.
> >
> > > > > > > any thoughts gratefully received..
> >
> > > > > > > george
> >
> > --
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Beginning Scalahttp://www.apress.com/book/view/1430219890
> > Follow me:http://twitter.com/dpp
> > Git some:http://github.com/dpp
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
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