[Lift] Re: Can't embed a snippet
Wouldn't this work with the Scala XML parser? xml:group h2Welcome/h2 pPut welcome details here./p /xml:group 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: h2Welcome/h2 pPut welcome details here./p 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: system-outMalformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html /system-out system-err:3:70: document must contain exactly one element ^ /system-err 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
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: lift:group h2Welcome/h2 pPut welcome details here/p /lift:group 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? xml:group h2Welcome/h2 pPut welcome details here./p /xml:group 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
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 no...@thewordnerd.infowrote: Cool deal, mvn test showed me the issue. Apparently, templates can only have a single element, I had an h2/ and a p/. 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: div h2/ p/ /div works whereas h2/ p/ 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-Beckerdchenbec...@gmail.com 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 no...@thewordnerd.info wrote: Cool deal, mvn test showed me the issue. Apparently, templates can only have a single element, I had an h2/ and a p/. 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
Ah, so this would be a top-level template (no lift:surround). Derek On Wed, Jun 24, 2009 at 9:16 AM, Kris Nuttycombe kris.nuttyco...@gmail.comwrote: The error was occurring if you had more than a single root element. Thus: div h2/ p/ /div works whereas h2/ p/ 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-Beckerdchenbec...@gmail.com 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 no...@thewordnerd.info wrote: Cool deal, mvn test showed me the issue. Apparently, templates can only have a single element, I had an h2/ and a p/. 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 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: h2Welcome/h2 pPut welcome details here./p 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: system-outMalformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html /system-out system-err:3:70: document must contain exactly one element ^ /system-err 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
Yes. Since it's a full template and not a fragment (using lift:surround /) 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 no...@thewordnerd.infowrote: 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: h2Welcome/h2 pPut welcome details here./p 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: system-outMalformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html /system-out system-err:3:70: document must contain exactly one element ^ /system-err 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
I've added an issue for this. On Wed, Jun 24, 2009 at 9:49 AM, David Pollak feeder.of.the.be...@gmail.com wrote: We should probably have a lift:dont_ignore/ tag to surround stuff like this and to complement the lift:ignore/ tag. Anyone want to add that snippet? On Wed, Jun 24, 2009 at 8:36 AM, Derek Chen-Becker dchenbec...@gmail.comwrote: Yes. Since it's a full template and not a fragment (using lift:surround /) 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 no...@thewordnerd.infowrote: 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: h2Welcome/h2 pPut welcome details here./p 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: system-outMalformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html /system-out system-err:3:70: document must contain exactly one element ^ /system-err 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
Perhaps something a touch more intuitive like lift:template/? It would feel odd to have to tell lift not to ignore stuff. Kris On Wed, Jun 24, 2009 at 9:49 AM, David Pollakfeeder.of.the.be...@gmail.com wrote: We should probably have a lift:dont_ignore/ tag to surround stuff like this and to complement the lift:ignore/ tag. Anyone want to add that snippet? On Wed, Jun 24, 2009 at 8:36 AM, Derek Chen-Becker dchenbec...@gmail.com wrote: Yes. Since it's a full template and not a fragment (using lift:surround /) 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 no...@thewordnerd.info 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: h2Welcome/h2 pPut welcome details here./p 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: system-outMalformed XML in 1 file: src/main/webapp/templates-hidden/welcome.html /system-out system-err:3:70: document must contain exactly one element ^ /system-err 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
On Tue, Jun 23, 2009 at 5:52 PM, Nolan Darilek no...@thewordnerd.infowrote: 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: lift:surround with=default at=content lift:Home h1Welcome back/h1 pThanks for logging in./p /lift:Home /lift:surround 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) = { pThanks again for logging in./p } case _ = lift:embed what=templates-hidden/welcome/ } } 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 -~--~~~~--~~--~--~---
[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 no...@thewordnerd.infowrote: On 06/23/2009 09:43 PM, David Pollak wrote: try /templates-hidden/welcome !--FIXME the /templates-hidden/welcome template not found-- -- 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 h2/ and a p/. 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 no...@thewordnerd.infowrote: Cool deal, mvn test showed me the issue. Apparently, templates can only have a single element, I had an h2/ and a p/. 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 -~--~~~~--~~--~--~---