[Lift] Re: Can't embed a snippet
Sleeping on it the snippet would be as simple as def group(c : scala.xml.NodeSeq) : scala.xml.NodeSeq = scala.xml.Group(c) which would allow for: Welcome Put welcome details here The advantage is that it is in the lift name space... Marc On 25/06/2009, at 8:59 PM, Marc Boschma wrote: > > Wouldn't this work with the Scala XML parser? > > > Welcome > Put welcome details here. > > On 25/06/2009, at 1:08 AM, Nolan Darilek wrote: > >> > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
Wouldn't this work with the Scala XML parser? Welcome Put welcome details here. On 25/06/2009, at 1:08 AM, Nolan Darilek wrote: > > On 06/24/2009 09:40 AM, Derek Chen-Becker wrote: >> Wait a second. I have plenty of templates that have multiple elements >> in them. What exactly is the problem you're seeing here? >> > Using 1.1, I have the following in templates-hidden/welcome.html: > > Welcome > > Put welcome details here. > > Running mvn test gives me the following failure report: > > --- > Test set: info.thewordnerd.therascribe.AppTest > --- > Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.8 > sec > <<< FAILURE! > testXml(info.thewordnerd.therascribe.AppTest) Time elapsed: 1.474 sec > <<< FAILURE! > junit.framework.AssertionFailedError: Malformed XML in 1 file: > src/main/webapp/templates-hidden/welcome.html > at junit.framework.Assert.fail(Assert.java:47) > at info.thewordnerd.therascribe.AppTest.testXml(AppTest.scala:72) > .. > > From the surefire report: > > Malformed XML in 1 file: > src/main/webapp/templates-hidden/welcome.html > > :3:70: document must contain exactly one element > ^ > > > Surrounding it in a div fixes that. Must be a new addition in 1.1? > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
Perhaps something a touch more intuitive like ? It would feel odd to have to tell lift not to ignore stuff. Kris On Wed, Jun 24, 2009 at 9:49 AM, David Pollak wrote: > We should probably have a tag to surround stuff like > this and to complement the tag. Anyone want to add that > snippet? > > On Wed, Jun 24, 2009 at 8:36 AM, Derek Chen-Becker > wrote: >> >> Yes. Since it's a full template and not a fragment (using > />) it has to conform to normal XML rules. In particular, XML can only have >> one root element. >> >> Derek >> >> On Wed, Jun 24, 2009 at 9:08 AM, Nolan Darilek >> wrote: >>> >>> On 06/24/2009 09:40 AM, Derek Chen-Becker wrote: >>> > Wait a second. I have plenty of templates that have multiple elements >>> > in them. What exactly is the problem you're seeing here? >>> > >>> Using 1.1, I have the following in templates-hidden/welcome.html: >>> >>> Welcome >>> >>> Put welcome details here. >>> >>> Running mvn test gives me the following failure report: >>> >>> >>> --- >>> Test set: info.thewordnerd.therascribe.AppTest >>> >>> --- >>> Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.8 sec >>> <<< FAILURE! >>> testXml(info.thewordnerd.therascribe.AppTest) Time elapsed: 1.474 sec >>> <<< FAILURE! >>> junit.framework.AssertionFailedError: Malformed XML in 1 file: >>> src/main/webapp/templates-hidden/welcome.html >>> at junit.framework.Assert.fail(Assert.java:47) >>> at info.thewordnerd.therascribe.AppTest.testXml(AppTest.scala:72) >>> .. >>> >>> From the surefire report: >>> >>> Malformed XML in 1 file: >>> src/main/webapp/templates-hidden/welcome.html >>> >>> :3:70: document must contain exactly one element >>> ^ >>> >>> >>> Surrounding it in a div fixes that. Must be a new addition in 1.1? >>> >>> >>> >> >> >> > > > > -- > 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
I've added an issue for this. On Wed, Jun 24, 2009 at 9:49 AM, David Pollak wrote: > We should probably have a tag to surround stuff like > this and to complement the tag. Anyone want to add that > snippet? > > > On Wed, Jun 24, 2009 at 8:36 AM, Derek Chen-Becker > wrote: > >> Yes. Since it's a full template and not a fragment (using > />) it has to conform to normal XML rules. In particular, XML can only have >> one root element. >> >> Derek >> >> >> On Wed, Jun 24, 2009 at 9:08 AM, Nolan Darilek wrote: >> >>> >>> On 06/24/2009 09:40 AM, Derek Chen-Becker wrote: >>> > Wait a second. I have plenty of templates that have multiple elements >>> > in them. What exactly is the problem you're seeing here? >>> > >>> Using 1.1, I have the following in templates-hidden/welcome.html: >>> >>> Welcome >>> >>> Put welcome details here. >>> >>> Running mvn test gives me the following failure report: >>> >>> >>> --- >>> Test set: info.thewordnerd.therascribe.AppTest >>> >>> --- >>> Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.8 sec >>> <<< FAILURE! >>> testXml(info.thewordnerd.therascribe.AppTest) Time elapsed: 1.474 sec >>> <<< FAILURE! >>> junit.framework.AssertionFailedError: Malformed XML in 1 file: >>> src/main/webapp/templates-hidden/welcome.html >>> at junit.framework.Assert.fail(Assert.java:47) >>> at info.thewordnerd.therascribe.AppTest.testXml(AppTest.scala:72) >>> .. >>> >>> From the surefire report: >>> >>> Malformed XML in 1 file: >>> src/main/webapp/templates-hidden/welcome.html >>> >>> :3:70: document must contain exactly one element >>> ^ >>> >>> >>> Surrounding it in a div fixes that. Must be a new addition in 1.1? >>> >>> >>> >>> >> >> >> > > > -- > 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
We should probably have a tag to surround stuff like this and to complement the tag. Anyone want to add that snippet? On Wed, Jun 24, 2009 at 8:36 AM, Derek Chen-Becker wrote: > Yes. Since it's a full template and not a fragment (using />) it has to conform to normal XML rules. In particular, XML can only have > one root element. > > Derek > > > On Wed, Jun 24, 2009 at 9:08 AM, Nolan Darilek wrote: > >> >> On 06/24/2009 09:40 AM, Derek Chen-Becker wrote: >> > Wait a second. I have plenty of templates that have multiple elements >> > in them. What exactly is the problem you're seeing here? >> > >> Using 1.1, I have the following in templates-hidden/welcome.html: >> >> Welcome >> >> Put welcome details here. >> >> Running mvn test gives me the following failure report: >> >> >> --- >> Test set: info.thewordnerd.therascribe.AppTest >> >> --- >> Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.8 sec >> <<< FAILURE! >> testXml(info.thewordnerd.therascribe.AppTest) Time elapsed: 1.474 sec >> <<< FAILURE! >> junit.framework.AssertionFailedError: Malformed XML in 1 file: >> src/main/webapp/templates-hidden/welcome.html >> at junit.framework.Assert.fail(Assert.java:47) >> at info.thewordnerd.therascribe.AppTest.testXml(AppTest.scala:72) >> .. >> >> From the surefire report: >> >> Malformed XML in 1 file: >> src/main/webapp/templates-hidden/welcome.html >> >> :3:70: document must contain exactly one element >> ^ >> >> >> Surrounding it in a div fixes that. Must be a new addition in 1.1? >> >> >> >> > > > > -- 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
Yes. Since it's a full template and not a fragment (using ) it has to conform to normal XML rules. In particular, XML can only have one root element. Derek On Wed, Jun 24, 2009 at 9:08 AM, Nolan Darilek wrote: > > On 06/24/2009 09:40 AM, Derek Chen-Becker wrote: > > Wait a second. I have plenty of templates that have multiple elements > > in them. What exactly is the problem you're seeing here? > > > Using 1.1, I have the following in templates-hidden/welcome.html: > > Welcome > > Put welcome details here. > > Running mvn test gives me the following failure report: > > > --- > Test set: info.thewordnerd.therascribe.AppTest > > --- > Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.8 sec > <<< FAILURE! > testXml(info.thewordnerd.therascribe.AppTest) Time elapsed: 1.474 sec > <<< FAILURE! > junit.framework.AssertionFailedError: Malformed XML in 1 file: > src/main/webapp/templates-hidden/welcome.html > at junit.framework.Assert.fail(Assert.java:47) > at info.thewordnerd.therascribe.AppTest.testXml(AppTest.scala:72) > .. > > From the surefire report: > > Malformed XML in 1 file: > src/main/webapp/templates-hidden/welcome.html > > :3:70: document must contain exactly one element > ^ > > > Surrounding it in a div fixes that. Must be a new addition in 1.1? > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
On 06/24/2009 09:40 AM, Derek Chen-Becker wrote: > Wait a second. I have plenty of templates that have multiple elements > in them. What exactly is the problem you're seeing here? > Using 1.1, I have the following in templates-hidden/welcome.html: Welcome Put welcome details here. Running mvn test gives me the following failure report: --- Test set: info.thewordnerd.therascribe.AppTest --- Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.8 sec <<< FAILURE! testXml(info.thewordnerd.therascribe.AppTest) Time elapsed: 1.474 sec <<< FAILURE! junit.framework.AssertionFailedError: Malformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html at junit.framework.Assert.fail(Assert.java:47) at info.thewordnerd.therascribe.AppTest.testXml(AppTest.scala:72) .. From the surefire report: Malformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html :3:70: document must contain exactly one element ^ Surrounding it in a div fixes that. Must be a new addition in 1.1? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
Ah, so this would be a top-level template (no lift:surround). Derek On Wed, Jun 24, 2009 at 9:16 AM, Kris Nuttycombe wrote: > > The error was occurring if you had more than a single root element. Thus: > > > > > > > works whereas > > > > > caused the "template not found" erroneous exception before David fixed > it. Thanks David! > > Kris > > On Wed, Jun 24, 2009 at 8:40 AM, Derek Chen-Becker > wrote: > > Wait a second. I have plenty of templates that have multiple elements in > > them. What exactly is the problem you're seeing here? > > > > Derek > > > > On Tue, Jun 23, 2009 at 10:09 PM, Nolan Darilek > > wrote: > >> > >> Cool deal, mvn test showed me the issue. > >> > >> Apparently, templates can only have a single element, I had an and > >> a . The book called it a fragment, so this wasn't entirely clear. In > >> any case, I put a div#welcome around it and now it works fine. Thanks > >> for the pointer. > >> > >> > >> > > > > > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
The error was occurring if you had more than a single root element. Thus: works whereas caused the "template not found" erroneous exception before David fixed it. Thanks David! Kris On Wed, Jun 24, 2009 at 8:40 AM, Derek Chen-Becker wrote: > Wait a second. I have plenty of templates that have multiple elements in > them. What exactly is the problem you're seeing here? > > Derek > > On Tue, Jun 23, 2009 at 10:09 PM, Nolan Darilek > wrote: >> >> Cool deal, mvn test showed me the issue. >> >> Apparently, templates can only have a single element, I had an and >> a . The book called it a fragment, so this wasn't entirely clear. In >> any case, I put a div#welcome around it and now it works fine. Thanks >> for the pointer. >> >> >> > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
Wait a second. I have plenty of templates that have multiple elements in them. What exactly is the problem you're seeing here? Derek On Tue, Jun 23, 2009 at 10:09 PM, Nolan Darilek wrote: > > Cool deal, mvn test showed me the issue. > > Apparently, templates can only have a single element, I had an and > a . The book called it a fragment, so this wasn't entirely clear. In > any case, I put a div#welcome around it and now it works fine. Thanks > for the pointer. > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
On Tue, Jun 23, 2009 at 9:09 PM, Nolan Darilek wrote: > > Cool deal, mvn test showed me the issue. > > Apparently, templates can only have a single element, I had an and > a . The book called it a fragment, so this wasn't entirely clear. In > any case, I put a div#welcome around it and now it works fine. Thanks > for the pointer. It's the problem of the day... you're the third person that's had the exact same issue. :-) > > > > > > -- 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
Cool deal, mvn test showed me the issue. Apparently, templates can only have a single element, I had an and a . The book called it a fragment, so this wasn't entirely clear. In any case, I put a div#welcome around it and now it works fine. Thanks for the pointer. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
I just implemented the code at: http://github.com/dpp/lift_1_1_sample/tree/master Also, please do an mvn test which will make sure all your templates are well formed XML On Tue, Jun 23, 2009 at 8:37 PM, Nolan Darilek wrote: > > On 06/23/2009 09:43 PM, David Pollak wrote: > > try /templates-hidden/welcome > > > > > > > > > > -- 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
On 06/23/2009 09:43 PM, David Pollak wrote: > try /templates-hidden/welcome > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Can't embed a snippet
On Tue, Jun 23, 2009 at 5:52 PM, Nolan Darilek wrote: > > OK, finally introducing the first bit of user dynamicity into my app. I > want my homepage to contain a bit of homepagy-type intro stuff for > logged-out users, but a dashboard-like interface when someone is logged > in. So I have this in index.html: > > > > Welcome back > > Thanks for logging in. > > > > And the following Home snippet: > > package info.thewordnerd.therascribe.snippet > > import scala.xml.NodeSeq > import net.liftweb.util._ > > import info.thewordnerd.therascribe.model._ > > class Home { > def render(in: NodeSeq): NodeSeq = User.currentUser match { > case Full(user) => { > Thanks again for logging in. > } > case _ => > } > > } > > But I get a comment in my rendered HTML telling me that the welcome > template isn't found. This happens regardless of whether I refer to it > as just welcome or templates-hidden/welcome. try /templates-hidden/welcome > > > My code is inspired by an example from the Mastering Lift book, where a > welcome_msg template from templates-hidden is embedded in the homepage. > I'm guessing this behavior was changed post 1.0? If so, do I just place > welcome.html in my webapp directory now? > > > > > -- 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---