i'd like to build a global-add function in the appController, so that
all controllers can use it. is that possible?
[App-Controller code:]
function add($modell)
{
if(!empty($this->data))
{
if($this->$modell->save($this->data))
{
$this->Session->setFlash('saved');
$this->redirect(array('action' => 'index'));
}
else
{
$this->Session->setFlash('not saved!');
}
}
}
[.........../]
for example the current controller is named LocationsController:
[code]
var $modell = $this->Location;
[..../]
Thats what i tryed, but it dont works.
Thanks if someone can help!
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment