We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33587
    • 16 Posts
    Hi,

    I read on the wiki that the way one would write modules for MODx manager is changed on the new release... to use snippets instead ?

    I wan to create a module for the manager with custom views.. where should I start ?
      • 28215
      • 4,149 Posts
      Correct, modules are gone in Revo. The method by which they did things was outdated, and so we’ve moved to something new - custom manager pages via modActions.

      modActions are abstract object representations of ’controllers’, or php files that fetch pages. This allows you to quickly and easily create custom manager pages that can have files located outside the manager/ folder. They are tied to modNamespaces, which are representations of 3rd Party Components (3PCs).

      There is an old tutorial here, but it doesn’t reflect the changes since alpha6, in which modActions are now tied to modNamespaces rather than modContexts. You can get the general idea from it though.

      Basically if you want to do custom manager pages (CMPs), you’ll need a ’core’ and ’core/controllers’ directory in your snippet (for now).

      So, say I want to create a custom manager page for my ’Zesty’ snippet, which is located in ’/assets/components/zesty/’. My main controller that serves up the manager page HTML is in ’assets/components/zesty/core/controllers/index.php’. Well, I’d:


      • Create a modNamepsace called ’zesty’ and give it the path: {base_path}assets/components/zesty/
        [list][li]This can be done via the modPackageBuilder function registerNamespace in your build script:
      [/li]
      [/list]
      $builder->registerNamespace('zesty',false,true,'{base_path}assets/components/zesty/');


      • Create a modAction, give it a namespace of ’zesty’, a controller of ’index’, haslayout ’1’, and lang_topics ’zesty:default’ (meaning that i want to load the ’default’ lexicon topic in the ’zesty’ namespace. You’ll need to create that lexicon later.
      • In my controller, simply return the HTML via a return statement.
      • And you’re done! You can review the tutorial for the more complex parts of the pages (just remember that actions are tied to modNamespaces now), and I recommend viewing the packages in modx-components SVN, as they have examples of build scripts and structures, found here:

        http://svn.modxcms.com/svn/modx-components/

      We’ll be putting up a more comprehensive, helpful tutorial on how to build custom manager pages once beta hits.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com