That doesn't make sense. Including a file *anywhere* in the
application imports it into the scope, this is part of PHP, not
CakePHP.

Try doing an absolute path include to the SDK from within your
bootstrap.php.

Also this: $this->facebook = new Facebook(); Should be done in the
controllers beforeFilter().

On Oct 11, 5:44 am, Ed Propsner <crotchf...@gmail.com> wrote:
> Thanks for the response Carlo,
>
> Loading the class in the bootstrap has the same effect as in the
> AppController ... the class is only available in the bootstrap and not the
> rest of the controllers or views. This seems strange to me and I'm starting
> to think I might be missing some other underlying problem. Short of
> importing the file into every controller and every view where I need to make
> a call to it, I cannot get it to work as expected.
>
> As I stated earlier ... in 1.3 it was as simple as:
>
> > App::import('Vendor', 'facebook)
>
> > function __construct(){
> >         parent::__construct();
>
> >         $this->facebook = new Facebook(array(
> >                     'appId' => $this->__api_key,
> >                     'secret' => $this->__app_secret ));
> >     }
>
> No problems, the class was accessible using $this->facebook->etc->etc
>  throughout my entire app.
>
> Was I doing it wrong then or am I doing it wrong now? Frankly, I'm ignorant
> enough in this area to not know the difference.
> Does 2.0 handle this differently and I'm just not understanding it?
>
> - Ed
>
>
>
>
>
>
>
> On Tue, Oct 11, 2011 at 12:15 AM, Carlo Cruz <yummydwa...@gmail.com> wrote:
> > You could always use a 'require_once' in bootstrap.
>
> > On Oct 11, 12:24 pm, Ed Propsner <crotchf...@gmail.com> wrote:
> > > I'm trying to load Facebook's php sdk. I'm currently using App::import.
> > > I'm loading it into the App Controller but the problem I'm having now is
> > > that the class is only available within that controller and not
> > accessible
> > > to the rest of my controllers.
>
> > > - Ed
>
> > > On Mon, Oct 10, 2011 at 9:12 PM, Miles J <mileswjohn...@gmail.com>
> > wrote:
> > > > If its for models, use ClassRegistry::init().
>
> > > > If you are including files, use App::import().
>
> > > > If you are adding a file to the lookup, use App::uses().
>
> > > >https://github.com/cakephp/cakephp/blob/2.0/lib/Cake/Core/App.php#L549
>
> > > > On Oct 10, 9:20 am, CrotchFrog <crotchf...@gmail.com> wrote:
> > > > > I'm still trying to figure out how to get function __ construct() to
> > > > > work properly for me, it throws errors when used the way I
> > > > > traditionally used it. I'm also still unsure whether I should be
> > using
> > > > > App::import() or App::uses(). I would tend to think App::import() but
> > > > > like I said I'm a little fuzzy in this area.
>
> > > > > Thanks,
>
> > > > > - Ed
>
> > > > > On Oct 9, 6:09 am, CrotchFrog <crotchf...@gmail.com> wrote:
>
> > > > > > I'm a bit confused in the proper use of App::import() vs.
> > App::uses()
> > > > > > in migrating to 2.0.
>
> > > > > > I'm try to load the Facebook php sdk from the Vendor folder as I
> > used
> > > > > > to in 1.3.
>
> > > > > > In 1.3 what worked for me was :
>
> > > > > > App::import('Vendor', 'facebook)
>
> > > > > > function __construct(){
> > > > > >         parent::__construct();
>
> > > > > >         $this->facebook = new Facebook(array(
> > > > > >                     'appId' => $this->__api_key,
> > > > > >                     'secret' => $this->__app_secret ));
> > > > > >     }
>
> > > > > > How should I be using the Constructor with App::uses()?
> > > > > > I've been through the Migration Guide to 2.0 and can see there has
> > > > > > been obvious changes but I suppose I don't have a clear enough
> > > > > > understanding to work out what I should be doing differently here.
>
> > > > > > - Ed
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group
> > > > athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to