Quote from: splittingred at Nov 02, 2009, 08:20 AM
Quote from: BobRay at Nov 01, 2009, 11:28 PM
Now I need to know what $ignorePkg means. 
Ignore the package directory when specifying the name or path. Otherwise, the package directory will be prefixed to the name of the class you’re trying to load.
Does that relate just to finding the class file, or does it affect the actual name of the variable used to access the class instance?
[update] I still have the question above but wanted to add some more.
I’m still wrestling with this. I’m getting closer but am still confused about some things. I’m determined to understand this.
As I understand it addPackage() doesn’t load anything, it just stores the path and thus tells xPDO where to find the class files. Since loadClass() appears to include that function, addPackage() appears to have the role of a convenience function like VB’s "with" that lets you use loadClass() without specifying a path and setting $ignorePkg.
Part of my confusion comes from the fact that addPackage() is very seldom used in MODx (though xPDO methods are used all over the place). No add-ons except captcha use it and the only other references I can find appear to be used to register the modx and xPDO packages. Is this so you can use loadClass(’captcha.VeriWord’) elsewhere in MODx? That would explain why it’s used there (though not otherwise necessary because the full path is used in loadClass() and $ignorePkg is set to true).
And would this code work:
$modx->addPackage('captcha',$captcha_core_path.'model/');
$modx->loadClass('captcha.VeriWord', '', false, true);
instead of the current code:
$modx->addPackage('captcha',$captcha_core_path.'model/');
$modx->loadClass('captcha.VeriWord',$captcha_core_path.'model/',true,true);
and, if so, would the second version be faster or preferred for some other reason?
Sorry for dragging this out, but I really want to understand it.