We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11105
    • 5 Posts
    Hi,
    I am new to the modx world and have been developing a small module as part of an upgrade from a previous cms.
    Basically the issue im having is in getting a list out of the database in a snippet in the front end.

    As far as i have read so far i think the problem lies in that i have added a few custom tables and relevant classes so i need to register these with modx somehow.
    I came across a comment someone left when they were having a similar issue with an addon and their solution was that they needed to go to system > system settings > edit : extension_packages and put in something like :
    {"packagename":{"path":"{core_path}components/packagename/model/"}}

    But i have tried this i have also tried variations of the above(clearing cache each time just in case smiley ) but no luck so far.

    All im trying to call in my snippet is :
    $collection = $modx->getCollection(’Foo’);

    This falls over with the error "ERROR @ /modx/index.php) Could not load class: Foo from mysql.foo. [2010-12-13 15:24:09] (ERROR @ /modx/index.php)"

    Any help here would be very much appreciated. Im sure I have just missed something very very obvious and I apologise if its something i have missed in the manual!
    Thanks in advanced.
      • 28215
      • 4,149 Posts
      Try:

      [{"packagename":{"path":"/path/to/modx/components/packagename/model/"}}]
      

      Note the [ and ] on the outside. Also note that {core_path} does not work in 2.0.5. You’ll need to explicitly set the path.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 11105
        • 5 Posts
        Thank you very much.
        I had got the [] i had missed them out above.

        So it was just the absolute path.

        Its also worth noting that the path needs to be :
        C:/path/to/modx/core/

        and Not :
        C:\path\to\modx\core\ if you are on a windows machine.

        Again thank you for the reply.
          • 22295
          • 153 Posts
          Also note that {core_path} does not work in 2.0.5. You’ll need to explicitly set the path.

          For future searchers: explicitly setting a path is highly not recommended.. this was fixed by splittingred a couple of days after his post here. since 2.0.6:
          https://github.com/modxcms/revolution/commit/13f2c0e39fb4be9bcd7270a334afb8de7312c8dd

          you should use [[++core_path]]
          also available: [[++base_path]] [[++assets_path]] [[++manager_path]]