We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13751
    • 5 Posts
    Hi I'm trying to develop my first extra in modx revo 2.2.0-pl2 and I've been following the doodles tutorial on rtfm and now I'm ready to move past the scope of that tutorial, but alas I'm kind of stuck. I was to branch out my extra to use multiple controllers and or actions.

    My extra is going to work very similar to the gallery extra created by Shaun McCormick but when looking through the code for the gallery extra I see that it is using multiple actions (which I assumed would be different controllers) when switching from albums to gallery items, but I can't figure out how to do that in my own extra... I've tried just simple adding action=portfolio/update to the url and creating a controller in my portfolios (the extra I'm trying to create) directory under the file name update.class.php and update.php, but I just get an error in the browser saying "Server Error" and the error logs don't say anything useful. So I assume that I'm just missing something in the means of how to create multiple controllers or adding and referencing actions from an extra.

    Thanks in advance if there are any resources that you can point me to or any advice that you could give me.
      • 13751
      • 5 Posts
      Okay well I just thought I should post what I found out...

      I needed to create the file portfolios/core/components/portfolios/controllers/portfolio/update.class.php and use the following code

      class PortfoliosPortfolioUpdateManagerController extends PortfoliosManagerController {
        public function process(array $scriptProperties = array()) {
       
        }
        public function getPageTitle() { return $this->modx->lexicon('portfolios'); }
        public function loadCustomCssJs() {
          $this->addJavascript($this->portfolios->config['jsUrl'].'mgr/widgets/portfolios.grid.js');
          $this->addJavascript($this->portfolios->config['jsUrl'].'mgr/widgets/home.panel.js');
          $this->addLastJavascript($this->portfolios->config['jsUrl'].'mgr/sections/index.js');
        }
        public function getTemplateFile() { return $this->portfolios->config['templatesPath'].'home.tpl'; }
      }
      


      to begin development on this new controller and controller action.
        • 13751
        • 5 Posts
        Oh and all those paths and controller names come from this in the url action=portfolio/update and the namespace being portfolios.

        Hope that helps someone else somewhere out there since it took me a few days to figure out what I was doing wrong.