We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    This is an auto-generated topic for <a href="http://modxcms.com/extras/package/605">SIMPLX_RPC 0.1-alpha</a> by larscwallin.

    Brief Description:
    SIMPLX RPC - by Lars C Wallin
    Version 0.1 - 091120

    * What is this Snippet anyway?
    SIMPLX RPC is a remote method invocation Snippet which makes it possible to call the ModX API from the client browser using XMLHTTP or similar. This means that you can fetch (for now...) data from ModX without reloading the page. This means more interactive, dynamic, responsive, personal web sites smiley

    The RPC (Remote Procedure Call) capability has been missing for too long in ModX i think. Well it turned out to be a real piece of cake to code it (much thanks to the simplicity of the ModX API but also thanks to the built in support for json in PHP). So here you are wink

    This Snippet simply wraps the modx API (http://wiki.modxcms.com/index.php/Ja:API:DocumentParser) with the json-rpc protocol (http://groups.google.com/group/json-rpc/web/json-rpc-1-2-proposal).
    It should match the documented API spot on i think.
    Note that this implementation uses named parameters. This means that the parameters collection must be
    represented as a JavaScript object with key/value pairs. This ensures that parameter sequence is not an
    issue when calling in method calls.

    * Why did i make it a Snippet?
    Well because it was the simplest and most plug-n-play way to do it. Also, what you get out-of-the-box by making it a Snippet is the ability to have access control over the remote api using the built in ModX security (as the remote service is just a document in ModX).

    * Whats next
    - Error handeling (according to the json-rpc spec.)
    - Security considerations
    - Create Update Delete features

    * IMPORTANT
    Please respect the SIMPLX_ namespace as i will make more contributions within it.

      • 27708 MODX Staff
      • 2,502 Posts
      This looks like an excellent add to Evo. XMLRPC is part of Revo but great to see some such functionality. I’d be interested to see some use cases or demo.

      Cheers,

      Jay
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 16681
        • 62 Posts
        Thanks smiley

        The uses for this kind of adhoc communication is endless. Especially when used with libraries such as ExtJS etc. Almost all major libraries for web development use json as state transfer of objects and there are LOTS of helper classes to do whatever.

        As i mentioned in the text above, JQuery has a great plug called JBind which uses templating to render json objects on the client.

        In Revo this kind of client server layering is used in the manager to make the backend more responsive and modern (it actually uses Ext i beliave...). This can also be done with Evo after i extended the SIMPLX_RPC API beyond the ModX standard API.

        Ill be making changes and posting more tips n tricks shortly.

        Ciao,
        Lars smiley
          Keep it SIMPLX
          • 16681
          • 62 Posts
          Hi smiley Forgot to add that the currently supported methods are,



          • getPageInfo

          • getTemplateVarOutput

          More will follow very shortly.

          IMPORTANT!
          Use and modify with care.
          Lets not fork this project to early on account of security implications. If you need features, ask me and i will implement them in time.
          Please comment regarding possible security issues and recommended steps to avoid misuse.
            Keep it SIMPLX
            • 16681
            • 62 Posts
            Hi,

            Next release will include


            • modx.db.select support
            • Demo files
            Give me a day or two smiley

            Ciao,
            Lars
              Keep it SIMPLX