PLEASE HELP ME!

FAILURE:
Warning (2): Cannot modify header information - headers already sent by
(output started at
/var/customers/webs/usr05/mkn151/app/models/category.php:1)
[CORE/cake/libs/controller/controller.php, line 742]

CONTROLLER:
<?php
class CategoriesController extends AppController {
        var $name = 'Categories';
        // Zugriff ohne Login
        function beforeFilter(){
            parent::beforeFilter();
                        $this->Auth->allow('choosecategories');
        }
        // Liste der Kategorien
        function index() {
                $this->Category->recursive = 0;
                $this->set('categories', $this->paginate());
        }
        // Detailansicht
        function view($id = null) {
                if (!$id) {
                        $this->Session->setFlash(__('Ungültige Kategorie', 
true));
                        $this->redirect(array('action' => 'index'));
                }
                $this->set('category', $this->Category->read(null, $id));
        }
        // Kategorie hinzufügen
        function add() {
                if (!empty($this->data)) {
                        $this->Category->create();
                        if ($this->Category->save($this->data)) {
                                $this->Session->setFlash(__('Kategorie wurde 
gespeichert.', true));
                                $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('Kategorie konnte 
nicht gespeichert werden.
Versuchen Sie es nochmal.', true));
                        }
                }
                $highscores = $this->Category->Highscore->find('list');
                $this->set(compact('highscores'));
        }
        // Kategorie bearbeiten
        function edit($id = null) {
                if (!$id && empty($this->data)) {
                        $this->Session->setFlash(__('Ungültige Kategorie', 
true));
                        $this->redirect(array('action' => 'index'));
                }
                if (!empty($this->data)) {
                        if ($this->Category->save($this->data)) {
                                $this->Session->setFlash(__('Kategorie wurde 
gespeichert.', true));
                                $this->redirect(array('action' => 'index'));
                        } else {
                                $this->Session->setFlash(__('Kategorie konnte 
nicht gespeichert werden.
Versuchen Sie es nochmal.', true));
                        }
                }
                if (empty($this->data)) {
                        $this->data = $this->Category->read(null, $id);
                }
                $highscores = $this->Category->Highscore->find('list');
                $this->set(compact('highscores'));
        }
        // Kategorie löschen
        function delete($id = null) {
                if (!$id) {
                        $this->Session->setFlash(__('Ungültige Kategorie Id', 
true));
                        $this->redirect(array('action'=>'index'));
                }
                if ($this->Category->delete($id)) {
                        $this->Session->setFlash(__('Kategorie wurde 
gelöscht.', true));
                        $this->redirect(array('action'=>'index'));
                }
                $this->Session->setFlash(__('Kategorie wurden nicht gelöscht.', 
true));
                $this->redirect(array('action' => 'index'));
        }
        // Kategorien auswählen
        function choosecategories() {
                //Session zu Beginn des neuen Spieles leeren
                $this->Session->destroy();
                //Kategorien auslesen
                if(empty($this->data)){
                        $this->set('categories', $this->Category->find('all'));
                }else{
                        $categories = array();
                        foreach ($this->data['Category'] as $key => $cat):
                                if($cat == 1){
                                        array_push($categories, $key);
                                }
                        endforeach;
                        //Sessions setzen
                        if(count($categories) > 0){
                                $this->Session->write('categories', 
$categories);
                                $this->Session->write('startTime', date('Y-m-d 
H:i:s'));
                                $this->Session->write('joker', true);
                                $this->Session->write('points', 0);
                                $this->redirect(array('controller' => 
'questions', 'action' => 'game'));
                        }else{
                                $this->set('categories', 
$this->Category->find('all'));
                        }
                }               
        }
}
?>

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Warning-2-Cannot-modify-header-information-headers-already-sent-by-tp4860658p4860658.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to