> > On Tue, Mar 2, 2010 at 11:07 AM, Rick R <rick.richard...@gmail.com> wrote: >> >> I have a pair of templates which rely on both a Snippet and a >> CometActor. There appears to be a "dependency injection" > > Dependency injection is an entirely different concept. Lift rewrites the > page as it goes out to insure comet and ajax support. >
Yes, that was the reason for the quotes. I am referring to the mechanism by which lift determines that a page required ajax, so it makes sure to include liftAjax.js. >> >> process of >> sorts where lift_page is defined and liftAjax.js is included. However, >> it looks like the list of things is being included in reverse order. > > What do you mean "reverse order"? Are you seeing an actual error? Is > something actually failing? Yes. As I indicate below (albeit in a messy fashion) the callbacks which use liftAjax are defined before liftAjax.js is included. Further, the variables which are needed by liftAjax.js, such as lift_page, are defined *after* liftAjax.js is included. This is what lead me to believe that these three sections are being rendered in reverse. What I would expect to see is lift_page being rendered before the inclusion of liftAjax.js which occurs before the definition of the functions which rely on liftAjax. >> (On a side note, is there any way to get GET params from a Rewrite to >> the render function in a CometActor? > > You can't. CometActors are not rendered in response to an HTTP request and > have no access to specific request state. That is fine, should one expect a SessionVar to work for a CometActor when it is set in response to a RewriteRequest? >> >> For example: (my comments -- inline) >> >> -- This is the start of the template: adminchat.html >> >> <h2>Welcome to The Interview Tool.</h2> >> <p> >> <div id="F1040260232478N4M_outer" style="display: inline"><div >> id="F1040260232478N4M" style="display: inline"><div> >> <p><span id="info"></span></p> >> <p> <!-- A place to put stuff --> >> >> -- the following is the result of including : Script(JsonInCode) from >> render in my CometActor. This makes sense that we need to define the >> callback before using it. Note, however, that it's referencing >> liftAjax.lift but we haven't included liftAjax.js yet. >> >> <script type="text/javascript"> >> // <![CDATA[ >> /* JSON Func Other $$ F104026023248133W */function >> F104026023248133W(obj) >> {liftAjax.lift_ajaxHandler('F104026023248133W='+ >> encodeURIComponent(JSON.stringify(obj)), null,null);} >> // ]]> >> >> </script> >> <input type="textarea" >> onkeypress="processKeyPress(event.which, function(a) >> {F104026023248133W({'command': "pressed", 'params':a});})" >> id="txt1" /> >> </p> >> </div><script type="text/javascript"> >> // <![CDATA[ >> >> F104026023248133W({'command': "connect", 'params':chatKey}); >> >> -- okay.. we define this function again, I'm not sure why and I didn't >> ask it to, but no real harm done. >> >> /* JSON Func Other $$ F104026023248133W */function >> F104026023248133W(obj) >> {liftAjax.lift_ajaxHandler('F104026023248133W='+ >> encodeURIComponent(JSON.stringify(obj)), null,null);} >> // ]]> >> </script></div><script type="text/javascript"> >> // <![CDATA[ >> var destroy_F1040260232478N4M = function() {} >> // ]]> >> </script></div> >> >> -- this is the end of the output from the CometACtor >> >> </p> >> >> -- this is the end of output from the template. >> >> </div> >> >> <hr /> >> </div> >> >> -- this should be the end of output from default.html, but I'm >> guessing this is where stuff gets merged in. >> -- Here we include liftAjax, it's a bit late, but it's still wrong >> because it relies on lift_page. >> >> <script type="text/javascript" src="/ajax_request/liftAjax.js"></script> >> <script type="text/javascript" >> src="/comet_request/xkvbzq4ueltw/cometAjax.js"></script> >> >> -- here's where we finally define the vars needed by liftAjax et al. >> >> <script type="text/javascript"> >> // <![CDATA[ >> var lift_toWatch = {"F1040260232478N4M": 1040260232480}; >> // ]]> >> </script> >> <script type="text/javascript"> >> // <![CDATA[ >> >> var lift_page = "F1040260232477ZYH"; >> // ]]> >> </script></body> >> </html> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Lift" group. >> To post to this group, send email to lift...@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, the simply functional web framework http://liftweb.net > Beginning Scala http://www.apress.com/book/view/1430219890 > Follow me: http://twitter.com/dpp > Surf the harmonics > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@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. > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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.