Hello,
I have a method called "init_logger()" in my Plugin's LoggerAppController
which does a redirect. And I want to call the "init_logger()" method from
my main applications AppController. But when I call my "init_logger()"
method I get the error message "call to member function header() on non
object". My Plugins AppController extends the Main AppController which
extends the Controller so I should be able to use $this but apparently it's
not an object when called from the main AppController for some reason. I
can't redirect nor can I check $this->action. $this is not an object.
Here's my Logger Plugin's LoggerAppController.php
<?php
>
> App::uses('AppController', 'Controller');
>
> class LoggerAppController extends AppController {
> /**
>
* This method is meant to be called from the main AppController
>
*
>
* @return void
>
*/
>
public function init_logger() {
$this->redirect(array('plugin'=>'logger', 'controller'=>'captchas',
> 'action'=>'solve'));
>
}
Here's my main applications AppController which I call this method from:
<?php
>
> /** Main AppController */
>
> App::uses('Controller', 'Controller');
App::uses('LoggerAppController', 'Logger.Controller');
>
> class AppController extends Controller {
>
> public function beforeFilter() {
$LoggerAppController =
> ClassRegistry::init('Logger.LoggerAppController');
>
$LoggerAppController->init_logger();
>
}
>
}
>
The method call works but it acts as if $this inside of my
LoggerAppController is not an object and I can't use any controller methods
or properties when called from the main AppController.
Anyone have ideas on what I might be doing wrong?
Thanks
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.