illuminatixs wrote:
<code>// Start bonnencontroller
class BonnenController extends AppController{
// Set access to helpers, components and paginator
public $helpers = array('Html', 'Form', 'Session');
public $components = array('Paginator', 'Cookie');
public $paginate;
// Start index function and get 15 "bonnen" per page
public function index() {
$this->Paginator->settings = array('limit' => 15, 'order'=>array('bon_id'=>'desc'));
$this->set('bonnen', $this->paginate());
}
// Start add function and add a new "bon" when request is generated
public function add() {
if ($this->request->is('post')) {
$this->Bonnen->create();
// Set creation date
$this->request->data = Date('Y-m-d H:i:s');
if($this->Bonnen->save($this->request->data)) {
$this->Session->setFlash(__('<br/>De bon is aangemaakt.'));
return $this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__('<br/>Kan de bon niet toevoegen door een onbekende fout.'));
}
}
</code>
Thanks for the coding..... Or whatever the F that is