We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    I have downloaded some docs I fonud on this site for development purposes. I wanted ot create a module but I can find no documentation on it and there are no modules to learn from and no demo blank module either.

    Is there some kind of reference for this someplace?
      • 32963
      • 1,732 Posts
      Quote from: webmedic at Jul 20, 2005, 09:43 AM

      I have downloaded some docs I fonud on this site for development purposes. I wanted ot create a module but I can find no documentation on it and there are no modules to learn from and no demo blank module either.

      Is there some kind of reference for this someplace?

      I’m going to try and see if I can put together some documentation this by now and the weekend.

      Writing a modules is pretty much the same as writing a snippet with the exeception that modules allow you to "echo" html.

      example:

      echo ’<html><head></head><body>’;
      echo ’<h1>My Phone Book</h1>’;
      // add some stuff here.
      echo ’</body></html>’;

      In order to use the MODx apis you should postback to the initial page. This way the MODx parser will be called. To do this I just simple wrap my pages inside a single <form>


      <script language="JavaScript" type="text/javascript">
      function postForm(opcode){
      document.module.opcode.value=opcode;
      document.module.submit();
      }
      </script>

      <form name="module" method="post">
      <input name="opcode" type="hidden" value="" />
      [+content+]
      </form>

      now when I need to send information back to the server I just use:


      <a href="javascript:;" onclick="postForm(’save’)">Save</a>
      <a href="javascript:;" onclick="postForm(’delete’)">Delete</a>
      <a href="javascript:;" onclick="postForm(’search’)">Search List</a>

      There are many different ways to do write a module. The way you choose will depend on your needs. Modules can even be made to run independent of MODx while only using MODx as a container or viewer.

        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
        • 22097
        • 37 Posts
        Yeah.. Documentation is REALLY needed on this subject. I would love to know what I could do with modules, but up until now I still don’t have a clue.
          • 33337
          • 3,975 Posts
          Hi Olaf !

          We are preparing a bit detailed guide, and this will be hopefully available in couple of days !

          So keep tuned, and the good news are about to coming your way laugh

          Regards,

          zi
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 25663 MODX Staff
            • 12,272 Posts
            Howdy folks,

            If you want a sneak peek at the modules docuementation (sans-images and editing) please mosey on over to http://www.modxcms.com/modules.html

            Enjoy!
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 33337
              • 3,975 Posts
              Thanks Ryan...

              Now docs are complete.

              Have fun ! smiley

              Regards,

              zi
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link
                • 21301
                • 93 Posts
                Ah, that clears up a lot. It looks like a lot of the manager menu items can be converted to modules this way. Is this what we’re heading for?

                I’d love to see the user manager to be a customizable module! For all users and their managers are different for each system. For local purposes I eg don’t need the ’state’ field, but do need others.

                Import, export, stats modules. I foresee endless possibilities. Is it that we later on easily add a module to the manager menu? I find running a module (one) too many clicks away now smiley Drifting away I’d say that the whole manager menu should be a module!
                  • 4673
                  • 577 Posts
                  Seems like that is in the plan. For everything to be a module in some sense. Of course, the main app needs to be there (like glue -- or framework) so that it can tie in everything else.

                  I’m really looking forward to this!
                    Tangent-Warrior smiley
                    • 32963
                    • 1,732 Posts
                    Yes most things can be converted into modules but somethings are better integrated.
                      xWisdom
                      www.xwisdomhtml.com
                      The fear of the Lord is the beginning of wisdom:
                      MODx Co-Founder - Create and do more with less.
                      • 3763
                      • 155 Posts
                      Hello,

                      sorry to bring this thread back to the top, but I have a little problem with a module.

                      I have some forms on a module page, one of them is updateing the modx_system_settings DB table. Everything works fine, but after the update, the value is not always available.
                      The value is from $modx->config[’mysetting’]

                      I know I could write a little PHP function to always query the DB, but I’d like to use the MODx API. After the DB update, I’m also updateing the value of $modx->config[’mysetting’] with this (but with no luck):
                      <?php
                      $result = $modx->db->select('setting_value', $modx->getFullTableName('system_settings'), " setting_name = 'mysetting'");
                      if ($result)
                         $modx->config['mysetting'] = $modx->db->getValue($result);
                      ?>


                      The forms are basic HTML forms, no data is submitted with Javascrip because I like to keep the scripts as clean as possible. From xwisdom’s post, I understood this could be fixed with following Javascript function:
                      <script language="JavaScript" type="text/javascript">
                         function postForm(opcode){
                              document.module.opcode.value=opcode;
                              document.module.submit();
                         }
                      </script>


                      My questions is, can it be done without it? Maybe force the API to update the settings values?

                      Thank you!

                      Boby
                        ...my Photo Gallery on Flickr...