We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5811
    • 1,717 Posts
    I run the following code line:

                    if (!$this->modx->loadClass('advsearch.advSearchResults',$this->config['modelPath'],true,true)) {
                        $this->modx->log(modX::LOG_LEVEL_ERROR,'[AdvSearch] Could not load advSearchResults class.');
                        return false;
                    }


    On Linux server I got the following error:
    [2011-07-07 21:47:07] (ERROR @ /index.php) Could not load class: advSearchResults from advsearch.advsearchresults.
    [2011-07-07 21:47:07] (ERROR @ /index.php) [AdvSearch] Could not load advSearchResults class.

    Why my class name advSearchResults (camelCase) is replaced as advsearchresults ?
    is a lowercase name mandatory for the name of class name ?

    I don’t find any issue regarding this in MODx tracker. Does it exist a quick fix ?

    my class file is advsearch/advSearchResults.class.php


    loadClass (line 398)

    Load a class by fully qualified name.

    The $fqn should in the format:

    dir_a.dir_b.dir_c.classname

    which will translate to:

    XPDO_CORE_PATH/om/dir_a/dir_b/dir_c/dbtype/classname.class.php

    return: The actual classname if successful, or false if not.
    access: public

    string|boolean loadClass (string $fqn, [ $path = ’’], [ $ignorePkg = false], [ $transient = false])

    string $fqn: The fully-qualified name of the class to load.
    $path
    $ignorePkg
    $transient

      • 5811
      • 1,717 Posts
      From xpdo class lines 444 to 449:
                  $class= substr($fqn, $pos +1);
                  if ($transient) {
                      $fqn= substr($fqn, 0, $pos) . '.' . strtolower($class);
                  } else {
                      $fqn= substr($fqn, 0, $pos) . '.' . $this->config['dbtype'] . '.' . strtolower($class);
                  }


      with line (line 424) : public function loadClass($fqn, $path= ’’, $ignorePkg= false, $transient= false) {

      where $fqn is the fully qualified name "advsearch.advSearchResults"
      Why the $class name is converted as lower case string ? is it mandatory ?
        • 5811
        • 1,717 Posts
        I get my answers here : http://modxcms.com/forums/index.php?topic=44528.0

        Due to xpdo conventions.

        [EDIT] Initial code line replaced by:
        		include_once dirname(__FILE__)."/advSearchResults.class.php";
        		if (!class_exists('AdvSearchResults')) {
                            $this->modx->log(modX::LOG_LEVEL_ERROR,'[AdvSearch] Could not load advSearchResults class.');
                            return false;
                        }
          • 3749
          • 24,544 Posts
          It’s a MODX convention that all file and directory names be in all lowercase. wink
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 5811
            • 1,717 Posts

            It’s a MODX convention that all file and directory names be in all lowercase.

            So I was a "camel case notation resistant" with ajaxSearch
            Not sure that with Evo the police was so fussy!
              • 3749
              • 24,544 Posts
              LOL. It’s not the Evo police. It’s case-sensitive *nix servers. Windows doesn’t care. wink

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting