We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4018
    • 1,131 Posts
    As many have probably read from sottwell, there’s definitely some areas in the code that could use an Ajax treatment. One of these is the templateWarning function in mutate_content.dynamic.action.php, which I worked on a bit to keep all the form options from disappearing whenever you changed the template. Anyways...

    I’ve been playing around with the idea of replacing the templateWarning function with an Ajax driven version. It’s definitely possible...but might prove to be a little tricky in some areas. A handful of variables in the SQL and output code for the template variables would likely need to be reworked to allow for variables from a $_GET statement. Plus, functions from tmplvars.inc.php and tmplvars.commands.inc.php would need to be referenced in a separate file that is called from a javascript function rather than being part of the mutate_content.dynamic.action.php. Might be doable...but I’ll have to play with the code a bit and see if I can get a working version that’ll act as a beta replacement. I’m still not sure if the javascript will allow for output of an HTMLArea TV or not...guess we’ll see! smiley More to come...

    Jeff
      Jeff Whitfield

      "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
      • 32963
      • 1,732 Posts
      Quote from: Bravado at Jun 27, 2005, 09:56 PM

      As many have probably read from sottwell, there’s definitely some areas in the code that could use an Ajax treatment.? One of these is the templateWarning function in mutate_content.dynamic.action.php, which I worked on a bit to keep all the form options from disappearing whenever you changed the template.? Anyways...

      I’ve been playing around with the idea of replacing the templateWarning function with an Ajax driven version.? It’s definitely possible...but might prove to be a little tricky in some areas.? A handful of variables in the SQL and output code for the template variables would likely need to be reworked to allow for variables from a $_GET statement.? Plus, functions from tmplvars.inc.php and tmplvars.commands.inc.php would need to be referenced in a separate file that is called from a javascript function rather than being part of the mutate_content.dynamic.action.php.? Might be doable...but I’ll have to play with the code a bit and see if I can get a working version that’ll act as a beta replacement.? I’m still not sure if the javascript will allow for output of an HTMLArea TV or not...guess we’ll see!? smiley? More to come...

      Jeff

      Hi Jeff,

      Since our last discussion about the templateWarning and using $_GET I’ve added a few lines to the code that does a simple post back and merge the posted data with content loaded from the database.

      This works just like a save. Restores the RTE content, etc. As for TVs I think I’ll leave those off the list because changing a template changes the TVs

      Ajax is also a good way to send data back and fort but IMO maintaing a viewstate will allow you to persist the entire content of the page much eaiser than you can with Ajax. Have you ever used ASP.NET’s viewstate? It’s not very efficient but it’s very flexible. Maybe a combination of both should do the trick.
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
        • 4018
        • 1,131 Posts
        You’re probably right about using Ajax for this. I thought about it more...and the more I think about it the more I’m not so sure that changing TV displays on the fly with Ajax is such a good idea. Probably better to keep the parsing of the TV’s on the server where they belong. Cause when you think about it, you’re relying on the browser’s ability to read in an XMLHttpRequest (an ActiveXObject in the case of IE). If anything goes wrong on the browser end...then you’re screwed as far as your output is concerned. Especially when it comes to outputting something like an HTMLArea TV...can’t really rely on the browser to load it correctly without a refresh. Posted data is probably much more reliable in this instance...I agree.

        Wouldn’t mind seeing the code you added. Since I’ve been playing around with the templateWarning function, it would be interesting to see what you’ve done with it. smiley

        Jeff
          Jeff Whitfield

          "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."