what is the name of the file?  is it tasks_controller.php?

On 5/14/06, Reggie <[EMAIL PROTECTED] > wrote:

I'm trying the "Ajax task list" tutorial at
http://grahambird.co.uk/cake/tutorials/ajax.php.  However, I am getting
the following error when trying to load it:

Fatal: Unable to load controller TasksController

Fatal: Create Class:

<?php
    class TasksController extends AppController
    {
    }
?>

I've copied and pasted the example, and even downloaded the example but
still get the same error.   I have 2 programs already working on this
Cake installation so I don't think there are any problems there.  I've
posted the controller code below.

Thanks in advance for any help

<?php
class TasksController extends AppController
        {
                var $name = 'Tasks';
                //var $helpers = array('Html', '_javascript_', 'Ajax');

                function index() {
                        $this->set('data', $this->Task->findAll());
                }

            function add() {

                if (!empty($this->params['data'])) {
                        if ($this->Task->save($this->params['data'])) {
                                $this->set('data', $this->Task->findAll());
                        $this->render('todo', 'ajax');
                    } else {
                                        // do nothing
                    }
                }
            }

                function done($id) {
                        $this->Task->id = $id;
                        $this->params['data']['Task']['done'] = 1;
                        if ($this->Task->save($this->params['data'])) {
                                $this->set('data', $this->Task->findAll());
                                $this->render('done', 'ajax');
                        }
            }

                function undo($id) {

                        $this->Task->id = $id;
                        $this->params['data']['Task']['done'] = 0;
                        if ($this->Task->save($this->params['data'])) {
                                $this->set('data', $this->Task->findAll());
                                $this->render('todo', 'ajax');
                        }
            }

            function delete($id) {
                //if (isset($this->params['form']['id'])){
                   // $id = intval(substr($this->params['form']['id'], 5));
               // }   //end if
                $this->Task->del($id);
                //delete should return same as add
                $this->set('data', $this->Task->findAll());
                $this->render('done', 'ajax');
            }
        }
?>



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to