On Apr 5, 2011, at 15:13, lsiden wrote:
> In other words, I'd like to instantiate it in my code like this:
>
> $my_instance = new MyClass($some_arg);
> $another_instance = new MyClass($another_arg);, ...
>
> If I define it in app/libs/my_class.php, can I still load it with
> App::import()? I tried it but couldn't figure out what arguments to
> use in import()? http://api13.cakephp.org/class/app#method-Appimport.
> I had to fall back on require_once(). I'm sure there is a more
> standard way to accomplish this, but I'm still learning Cake.
Sure you can use App::import() to import a library you've written and placed in
APP/libs. If you have APP/libs/my_class.php containing a class MyClass, then
you would run App::import('Lib', 'MyClass'); to import it.
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php