We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37946
    • 70 Posts
    Hello, I am following the rtfm guide to build my own cmp.

    Developing an Extra in MODX Revolution Part II

    Everything has gone quite smooth until I try to load my base class.

    if (!$this->modx->loadClass('reportsControllerRequest',$this->config['modelPath'].'reports/request/',true,true)) {
                   return 'Could not load controller request handler.';
                }
    


    I am unable to load the class. I have echoed out my modelPath setting and it is correct:

    echo $this->config['modelPath']; // produces /Applications/MAMP/htdocs/site/trunk/core/components/reports/model/
    


    So it looks like the entire path should be this:
    echo $this->config['modelPath'].'reports/request/'; // produces Applications/MAMP/htdocs/site/trunk/core/components/reports/model/reports/request/ 
    


    ...which is correct.

    Initially I had the physical file name in mixed case. But I read a post that suggested making it lower case which I have done: "reportscontrollerrequest.php"

    From the modx error logs I get:
    "Could not load class: reportsControlleRrequest from reportscontrollerrequest."

    It just looks like everything is in the right spot. Clearly I am doing something wrong, any suggestions?

    Thank you for your time!
      • 33968
      • 863 Posts
      That looks a bit weird:
      Could not load class: reportsControlleRrequest from reportscontrollerrequest

      Perhaps check through your code and fix the capitals - if that's not just a typo it might be your problem. Otherwise check the class name matches up in your schema...
        • 31946
        • 116 Posts
        I think your Controller-filename should be:
        reportscontrollerrequest.class.php

        And the class inside this file:
        class reportsControllerRequest extends modRequest {}

        Maybe you made a mistake with the capital letters?
          • 37946
          • 70 Posts
          Thank you both, I was indeed missing the ".class.php"