I'm using the great Facebook plugin for cakephp 1.3 by http://www.webtechnick.com. This is what I have at the moment:
class UsersController extends AppController {
var $name = 'Users';
var $components = array('Facebook.Connect');
function beforeFilter {
$this->set('facebookUser', $this->Connect->user());
}
}
But I want to load the Facebook.Connect component conditionally, and use it in the controller - something like this in sudocode...
if ($thisIsTrue) {
Load_the_component_and_make_it_ready_for_use;
$this->set('facebookUser', $this->Connect->user());
}
How should I do this?
If you are doing this in CakePHP 2.0 it is really easy. I found this SO thread which discouraged me originally, but it must be a 1.3 and lower issue. For example:
public function beforeFilter(){
parent::beforeFilter();
$this->Paypal = $this->Components->load('Paypal');
}
And that's all she wrote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With