>> Comment:
     - I followed the online manual in coding the Post Blog example
and an error occured in the add view. What is wrong with this code?
Please help...!!!
>> Error Report:
     - Fatal error: Call to undefined method FormHelper::create() in C:
\web\www\cake\app\views\posts\add.ctp on line 5

--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
// add.ctp

<?php

echo '<h1>Add Post</h1>';

echo $form->create('Post');
echo $form->input('title');
echo $form->input('body', array('rows' => '3'));
echo $form->end('Save Post');


echo $html->link('Go back to List', "/posts/index/");

?>
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
// posts_controller.php

class PostsController extends AppController
{
        var $name = 'Posts';
        var $helpers = array('Html', 'Form');

        function index()
        {
                $this->set('posts', $this->Post->findAll());
        }

        function view($id = null)
        {
                $this->Post->id = $id;
                $this->set('post', $this->Post->read());
        }

        function add()
        {
                if(!empty($this->data))
                {
                        if($this->Post->save($this->data))
                        {
                                $this->flash('Your post has been 
saved.','/posts');
                        }
                }
        }

        function delete($id)
        {
                $this->Post->del($id);
                $this->flash('The post with id: '.$id.' has been deleted.', '/
posts');
        }

}

?>
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to