We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    I’m trying to create a new "module" for Revolution; I suppose I’d better get used to calling it a "Component". Anyway, whatever you want to call it, I’ve got a serious question.

    In /core/components/ I create a new directory, /core/components/listmail/. In my new listmail directory I put a file, mailer.php.

    Now I create a new namespace, "listmail". Then I create a new action, with "mail" as the controller. So far so good... Now I create a new menu item under Components. But all I get is the option for "mail/index.php", which is not at all what I had in mind.

    Do components require an initial index.php file? And this must reside in a directory of the same name as the controller specified in the Action form?
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Well, I actually got it to work at one point. I saved the action as listmail->mail/index.php, then created a new menu item under Components. I have to do a hard refresh of the browser every step of the way, but I finally got a menu item under Components that ran my "Hello, world" code in the right space.

      Now, I’ve come back, and the menu item is there, but the reference is gone so it just loads the Manager home page with an action of 0; if I go into the Actions menu and Update Menu, the action is set to No Action and it simply won’t save anything else.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 17499 ☆ A M B ☆
        • 872 Posts
        If i understand correctly, the menu action will always point to index if you want to stay in the manager since it’s all in ajax with connector’s pointing to index.php which include all the libs etc...

        Your connector can be whatever you want, but the landing page still is index.php.

        Then you can have to rely the Menu to the action corresponding.

        That’s where i also meet some problem.
        When i updated the menu with the dropdown list, it set the action to 0 on the database.

        I changed it manually with mysqlyog directly in the database to make it point to the action id and forget to tell the dev team to check wether it is an issue or not.

        The problem only occur when i create/update manually from the manager interface.

        You should check if it is also the case for you.

          • 28215
          • 4,149 Posts
          By the way, "controller" simply points to the controller file. Its path is built from the Namespace’s path. So, say I had a Namespace with path of:

          {core_path}components/listmail/

          That would point to my core/components/listmail/

          Then I can add an Action with the controller field set to ’list’ and it will look for:

          {core_path}components/listmail/list.php

          If list.php isn’t found, it will look for list/index.php automatically. If neither is found, it will say there’s no controller.

          So, those Actions with a controller value set to ’index’ will look for a core/components/listmail/index.php file.


          Now, I’ve come back, and the menu item is there, but the reference is gone so it just loads the Manager home page with an action of 0; if I go into the Actions menu and Update Menu, the action is set to No Action and it simply won’t save anything else.

          This was a bug with beta3; it should be fixed in SVN (I think I fixed it last week sometime).

          We may try and clean up this process some in the UI. Suggestions are welcome.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 28215
            • 4,149 Posts
            Susan, also, if you feel that there needs to be more info in the Confluence page for Component CMPs (Custom Manager Pages), feel free to expand it:

            http://svn.modxcms.com/docs/display/revolution/Custom+Manager+Pages
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Revision 5692, Wayfinder doesn’t produce anything.

              feel free to expand it
              I do; I’ve added two pages to the documentation so far wink
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Ok, back to components.

                1. I create a directory in core/components, core/components/listmailer.
                2. In core/components/listmailer I put a file, listmailer.php.
                3. I add a namespace, listmailer, with a path of {core_path}components/listmailer
                4. I create a new Action with a Controller of listmailer and a Namespace of listmailer, with Load Headers checked. Everything else left blank.
                5. I create a new Top Menu in Components with a text of ListMailer, description of ListMailer 0.1 - Mailing list application for Revolution, and the Action menu only offers listmailer - listmailer/index.php for a selection (other than a bunch of core stuff that obviously doesn’t apply)

                When I select that one and save, it has ’83’ in the field; presumably that’s the ID of this particular component.

                If I save it again, it changes to ’No Action’ and won’t do anything else, so I presume the bug hasn’t been fixed. I corrected it in the menus table in the database.

                Selecting the new component from the Components menu causes a 500 error.

                <?php
                /** listmailer 0.1 - mailing list application for Revolution
                *
                * Author - [email protected]
                * August 30 2009
                *
                **/
                
                return "Hello, world!";
                ?>
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 17499 ☆ A M B ☆
                  • 872 Posts
                  Quote from: sottwell at Aug 30, 2009, 12:12 AM

                  If I save it again, it changes to ’No Action’ and won’t do anything else, so I presume the bug hasn’t been fixed. I corrected it in the menus table in the database.

                  Selecting the new component from the Components menu causes a 500 error.


                  The "No action" bug is also in beta-3.

                  The combobox let me choose the action name and suppose to set the action value, but it doesn’t work.

                  Even if you put manually the action id, it save to 0.


                  The only ways to make it work was to set it up manually in the database or via package builder.
                    • 28215
                    • 4,149 Posts
                    lossendae,

                    Quote from: splittingred at Aug 29, 2009, 09:13 PM

                    This was a bug with beta3; it should be fixed in SVN (I think I fixed it last week sometime).

                    Thanks for noting.
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                      • 17499 ☆ A M B ☆
                      • 872 Posts
                      @Shaun


                      Unless I am mistaken, it’s seems that there is still another similar problem since Sotwell use the last svn.

                      If not, it’s noted. smiley