When I use $this->set in my controller it doesn't seem to work, I
think this could be due to my beforeFilter as I have it takes the
current action, then checks the first variable to determine which view
to show.
function beforeFilter() {
if (in_array($this->params['action'],$this->actions)) {
if ( !( empty($this->params['pass'][0]) ) ) {
$this->render(DS . 'admins' . DS .
$this->params['action'] . DS .
$this->params['pass'][0]);
} else {
$this->render(DS . 'admins' . DS .
$this->params['action'] . DS .
'index');
}
}
}
My controller action looks like this. When I echo it in the view it
says undefined variable, so could this be due to the way I have my
beforeFilter set up?
function type($load = null,$id = null) {
switch ($load) {
Case 'add':
if(!empty($this->data)) {
if($this->Type->save($this->data)) {
$this->Session->setFlash('Type
has been saved.');
$this->redirect(array('controller'=>'admins','action'=>'type'));
} else {
$this->Session->setFlash('An
error has occured in saving
type.');
}
}
$this->set('test','test');
break;
--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---