We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3689
    • 264 Posts
    I’m not sure where to put this so thought this would be a good place smiley

    I’m developing websites for real estate agents and would like to make it as easy as possible to add/edit the homes on the page.. I was thinking about adding something like "Add Home" and "Edit Home" to the area where it says "Welcome to your MODx Content Manager".. same place where you will find Security..Elements..Backup. I would also want to hide the site tree.. that way They can just have that 1 little section and it shouldnt be too confusing for anyone to use.

    Is this possible?
      • 7231
      • 4,205 Posts
      Yes. As of 1.0 there are events that make it so that you can add links or whatever to the manager welcome (or home) page. Here is a demo of how to do this with a plugin:

      1) Note the ID of the parent where you want to create the new document. FOr this example lets say the parent is ID 12;
      2) Create a new plugin, you can name it whatever you want, we will name it Custom Home Links for this example;
      3) Paste int he code bellow:

      // <?php
      
      $e = &$modx->Event;
      $output ='';
      
      switch($e->name) {
          case 'OnManagerWelcomeHome':
              $output = "<h1><a href=\"index.php?a=4&pid=9\" title=\"Add Home\">Add Home</a><br /><a href=\"index.php?a=4&pid=12\" title=\"Add Rental Home\">Add Rental Home</a></h1>";
          break;
             
          default:
              $output = '';
          break; 
      }
          
      $e->output($output);
      
      return;


      4) Before saving the plugin select the System Events tag and select the OnManagerWelcomeHome event
      5) Save the plugin and go to the Manager home. There should now be 2 links in <h1> tags directly above the standard options.

      You can style the links however you want by editing the CSS file located at media/style/MODxCarbon/style.css OR create a new theme and use a duplicate css file to avoid having it overwritten during an upgrade.

      How to find out the URL for creating new docs or editing exiting docs? With experience you will know that the action for new docs is 4 so the a=4 in the url string will tell modx to create a new doc and the pid=12 will tell it the Perent ID (hence pid). The action for editing id 27 or a=27 and instead of pid you simply use id or id=10 to edit doc 10. The shortcut to finding these codes is to enter the edit resource mode in the manager and open the edit frame in it’s own tab and see the URL for it (or select open link in new tab directly when making the selection in the menu).

      Anyway, I hope this helps. grin

      Edit: Note that this can also be done manually by editing the manager home page directly. There is a wiki post that covers this method:
      http://wiki.modxcms.com/index.php/Customizing_the_Manager_Homepage

      I prefer to use a plugin since it will not be overwritten during upgrades and is easier to manage.
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don&#39;t know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 11055 ☆ A M B ☆
        • 3,112 Posts
        This is why I love MODx!

        No others can beat this flexibility. laugh
          Rico
          Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
          MODx is great, but knowing how to use it well makes it perfect!

          www.virtudraft.com

          Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

          Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

          Maintainter/contributor of Babel

          Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
          • 26931
          • 2,314 Posts
          wow - how cool is that grin thanks Shane

          i was aware of those Manager System events, but not how easy it is to actually make use of them
            • 7231
            • 4,205 Posts
            Here is a post outlining the 3 new options for events on the manager home page.
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don&#39;t know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 3689
              • 264 Posts
              didnt expect a response like this grin thx! I’ll have to go thru this later tonite but this seems like its exactly what im lookin for grin
                • 3689
                • 264 Posts
                in the file theres
                <a href=\"index.php?a=4&pid=4\"
                the pid would be page ID but what is the "a"? is there a list of all these different abbreviations?

                My "Listings" page is the parent to all the property pages which r the child pages.. How do I target the "View Children" section for "Listings" (pid=4) so I can have that as the "Edit Listing" section

                Thanks !
                  • 7231
                  • 4,205 Posts
                  To get to the view children section will be tough since it is a tab on the overview page (unless I am misunderstanding your request). However, you could create a plugin that lists the children of a defined parent programmatically... you could even use wayfinder or Ditto in the plugin to generate the list of docs. I think that you would need to use the api ro execute the snippet since the parser doesn’t parse the manager pages. I will see if I can get an example for you since it is a handy thing to be able to do.

                  As for the actions, you can get the actions in the code of the manager index.php page. However, I am lazy and just open a page out of the frameset and look at the url to figure them out.
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 7231
                    • 4,205 Posts
                    Ok, that was fun and this can be a cool setup for editing.

                    I used wayfinder to list the children of a section by using the following plugin code set to the OnManagerWelcomeHome event:

                    // <?php
                    
                    $e = &$modx->Event;
                    $output ='';
                    
                    switch($e->name) {
                        case 'OnManagerWelcomeHome':
                            // set parent ID
                            $parentId = '2';
                            
                            // set the tpl - can also be done in chunks and use chunk name in the param array
                            $rowTpl = '@CODE: <li><a href="index.php?a=27&id=[+wf.docid+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></li>';    
                            $outerTpl = '@CODE: <h1>Edit Section Title</h1><ul>[+wf.wrapper+]</ul>';
                            
                            // set params for Wayfinder - params needs to be an array
                            $params['startId'] = $parentId;
                            $params['level'] = '1';
                            $params['ignoreHidden'] = 'TRUE';
                            $params['rowTpl'] = $rowTpl;
                            $params['outerTpl'] = $outerTpl;
                            
                            
                            // execute snippet
                            $output = $modx->runSnippet('Wayfinder', $params);
                        break;
                           
                        default:
                            $output = '';
                        break; 
                    }
                        
                    $e->output($output);
                    
                    return;


                    You can use as many of the Wayfinder parameters as needed to get the output you want.

                    Hope this helps... i sure will find it handy grin

                    There is so much that you can do with these events for the home page. I will work on a post with examples of how to add tabs as well as other cool things.

                    Note: this should be on one line, not sure why it is broken in to 3 lines in the code above:
                    $rowTpl = ’@CODE: <li><a href="index.php?a=27&id=[+wf.docid+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></li>’;
                      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                      Something is happening here, but you don&#39;t know what it is.
                      Do you, Mr. Jones? - [bob dylan]
                      • 3689
                      • 264 Posts
                      Quote from: dev_cw at Dec 19, 2009, 11:19 PM

                      Ok, that was fun and this can be a cool setup for editing.

                      I used wayfinder to list the children of a section by using the following plugin code set to the OnManagerWelcomeHome event:

                      // <?php
                      
                      $e = &$modx->Event;
                      $output ='';
                      
                      switch($e->name) {
                          case 'OnManagerWelcomeHome':
                              // set parent ID
                              $parentId = '2';
                              
                              // set the tpl - can also be done in chunks and use chunk name in the param array
                              $rowTpl = '@CODE: <li><a href="index.php?a=27&id=[+wf.docid+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></li>';    
                              $outerTpl = '@CODE: <h1>Edit Section Title</h1><ul>[+wf.wrapper+]</ul>';
                              
                              // set params for Wayfinder - params needs to be an array
                              $params['startId'] = $parentId;
                              $params['level'] = '1';
                              $params['ignoreHidden'] = 'TRUE';
                              $params['rowTpl'] = $rowTpl;
                              $params['outerTpl'] = $outerTpl;
                              
                              
                              // execute snippet
                              $output = $modx->runSnippet('Wayfinder', $params);
                          break;
                             
                          default:
                              $output = '';
                          break; 
                      }
                          
                      $e->output($output);
                      
                      return;


                      You can use as many of the Wayfinder parameters as needed to get the output you want.

                      Hope this helps... i sure will find it handy grin

                      There is so much that you can do with these events for the home page. I will work on a post with examples of how to add tabs as well as other cool things.

                      Note: this should be on one line, not sure why it is broken in to 3 lines in the code above:
                      $rowTpl = ’@CODE: <li><a href="index.php?a=27&id=[+wf.docid+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a></li>’;

                      thx! I got it to how I want smiley.. is there a document for changing this welcome page around? Like rebranding, removing the site tree, adding/removing certain things like security/web users/modules, stylin with CSS? just tryin to find ways to make it as easy as possible for clients smiley

                      thanks for the help!