We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37521 ☆ A M B ☆
    • 30 Posts
    Hello! I don't understand where I'm wrong. I created class Timeline in /path/to/core/components/mycmp/model/mycmp/timeline.class.php. Then I want to use this class in snippet:
    $timeline = $modx->getService('timeline', 'Timeline', 
        $modx->getOption('core_path') . 'components/mycmp/model/mycmp',
        $scriptProperties);

    So it doesn't work. Error log:
    (ERROR @ /index.php) Could not load class: Timeline from timeline.
    (ERROR @ /index.php) Problem getting service timeline, instance of class Timeline, from path /path/to/core/components/mycmp/model/mycmp

    This question has been answered by okyanet. See the first response.

      • 27708 MODX Staff
      • 2,502 Posts
      I hardly have a grasp of this but you could check this to make sure it all matches up: http://rtfm.modx.com/display/revolution20/Developing+an+Extra+in+MODX+Revolution

      From what I understand the classname, class file and location must be matched but other than that I've just defined the location without the getService but I am hardly a developer.
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
      • discuss.answer
        • 33968
        • 863 Posts
        You're missing a forward slash on the end of your path:
        $timeline = $modx->getService('timeline', 'Timeline',$modx->getOption('core_path') . 'components/mycmp/model/mycmp/',$scriptProperties);
        
          • 37521 ☆ A M B ☆
          • 30 Posts
          Yes, thank you smiley