We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42689
    • 125 Posts
    Hello all user's ..

    i want to create new Custom functionality in mod'x manager by using php query.. so can some one tell me how can i create new page or menu in mod'x manager and after that add my php Custom coding in it ..! can some one tell me how can i do it ..?

    It's really very urgent .

    Thanx for the help smiley
      • 1343 ☆ A M B ☆
      • 2,213 Posts
      You might want to check into CMPs (http://rtfm.modx.com/display/revolution20/Custom+Manager+Pages), it sounds like just what the doctor ordered.
        Patrick | Server Wrangler
        About Me: Website | Tweets |  MODX Hosting
        • 42689
        • 125 Posts
        Hey i have already check this link and i am follow this page also,but i have one issue in this

        hope u can solve this.

        which file i have create index.php for my menu .. at that file i have putt that code for call the modax confix file and manage the left bar in my page
        <?php
        $basePath = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
        require_once $basePath . '\config.core.php';
        require_once MODX_CORE_PATH . 'config/' . MODX_CONFIG_KEY . '.inc.php';
        require_once MODX_CONNECTORS_PATH . 'index.php';
        $modx->request->handleRequest( array(
            'processors_path'   => $modx->getOption( 'core_path' ) . 'components/mycomponent/processors/',
            'location'          => ''
        ) );
        ?>
        <?php
        return $modx->smarty->fetch( '/path/to/templates/list.tpl' );
        $modx->smarty->assign( '_lang', $this->modx->lexicon->fetch() );
        ?>
        <h2 class="modx-page-header">{$_lang.mycomponent}</h2>
        
        <?php
        $o = '<div class="test"><h2>My Component</h2></div>';
        
        return $o;
        ?>
        


        but its show error

        Notice: Constant MODX_CORE_PATH already defined in D:\xampp\htdocs\paragon\config.core.php on line 2
        
        Notice: Constant MODX_CONFIG_KEY already defined in D:\xampp\htdocs\paragon\config.core.php on line 3
        
        Notice: Undefined index: action in D:\xampp\htdocs\paragon\core\model\modx\modconnectorrequest.class.php on line 61
        {"success":false,"message":"Access denied.","total":0,"data":[],"object":{"code":401}}


        plz can u give me any idea's ..?

        thanxx
          • 28042 ☆ A M B ☆
          • 24,524 Posts
            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
            By the way, you don't really need to use ExtJS and Smarty for CMPs if you don't want to. Just follow the first 4 steps, to the point where you get the menu item and it opens a right-column working area, then put whatever you want in that controller file.

            http://rtfm.modx.com/display/revolution20/Custom+Manager+Pages+Tutorial
              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
              • 42689
              • 125 Posts
              Thaanx sottwell for reply,

              i will tell u in actually what i want ..? i want to crate one menu in manager and i want to get some data from database in that menu page ..!

              can i have done my that work from that page reference ..?

              http://rtfm.modx.com/display/revolution20/Custom+Manager+Pages+Tutorial

              Thanx smiley
                • 42689
                • 125 Posts
                Yeah i see your reference page.. in this we can also get the content by using this way
                <?php
                return 'This is my first Custom Manager Page';
                ?>
                


                but this is only use for the Plain-Old HTML text in our page .. but i want to get some data from the database for example:-
                $query=mysql_query("select * from modx_menus");
                while($query_res=mysql_fetch_array($query))
                {
                    echo $query_res['text'];
                }
                


                So how can i manage that code ..? how can i run php query in my page..?

                thanx smiley
                  • 42689
                  • 125 Posts
                  pleace give me solution sottwell ,

                  today is last date for my project..

                  Thanx in advance smiley
                    • 42689
                    • 125 Posts
                    i have also follow the this page

                    http://rtfm.modx.com/display/revolution20/Custom+Manager+Pages+in+2.3#CustomManagerPagesin2.3-SettingtheNamespacePath


                    in this we can call the new template after that we can manage the template text according to our self in html or core php query .. i have follow all instruction's also, but still its did not show the correct output..!

                    plz help smiley
                      • 42689
                      • 125 Posts
                      we did NOT use print, or echo, or raw HTML in our PHP. If we use any of these, i'll find that the text floats to the top of the page,
                      Remember that a Custom Manager Page is really acting as a function, so it should return a value.



                      can some one tell me how can we use the print, or echo, or raw HTML in our PHP ..?

                      Thanx smiley