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

    I’m looking into the nice features of modules in ModX. I want to use a module as kind of a library which I can use in my snippets. I already made a piece of code to use the Chunks facility of ModX as a sort of Templateparser, but now I want to make it available in a module so I can assign the module to a snippet and then use it in my code.

    My questions:
    First: Is this possible?
    Second: If it is, can someone show me some code on how to use a module in a snippet.

    Thanks in advance
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: sander- at Dec 06, 2006, 12:03 PM

      Hi,

      I’m looking into the nice features of modules in ModX. I want to use a module as kind of a library which I can use in my snippets. I already made a piece of code to use the Chunks facility of ModX as a sort of Templateparser, but now I want to make it available in a module so I can assign the module to a snippet and then use it in my code.

      My questions:
      First: Is this possible?
      Second: If it is, can someone show me some code on how to use a module in a snippet.

      Thanks in advance
      My perspective on this is that code is code. Modules will probably disappear in the future; they won’t make sense once the back-end can be managed and customized the same way the front-end is. And you can already easily create reusable, shared libraries of code by defining them as classes and using them across any kind of MODx code container (i.e. snippet, plugin, module).
        • 26104
        • 36 Posts
        True, already did that. I’m using a pair of classes to do some things, but at this time I have to include and execute these classes everytime and I was wondering if i could make this more easy.