That's the error message PHP delivers when something is printed to screen 
before the actual output (the headers referred to in the error message). Check 
you code for debug statements or other errors that could be doing this.

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 23 Nov 2010, at 16:26, John Maxim wrote:

> <?php
> class PostsController extends AppController {
> var $name = 'Posts';
>        function index() {
>        $this->set('posts', $this->Post->find('all'));
>        }
>        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->Session->setFlash('Your post has been saved.');
>    $this->redirect(array('action' => 'index'));
>                       }
>               }
>       }
> }
> ?>
> 
> I'm using the above code as the posts_controller
> 
> As I try to key in some thing to Add.. from my index page :
> 
> <!-- File: /app/views/posts/index.ctp -->
>    <h1>Blog posts</h1>
>       <?php echo $this->Html->link('Add Post', array('controller' =>
> 'posts', 'action' => 'add')); ?>
>       <table>
>    <tr>
>    <th>Id</th>
>    <th>Title</th>
>    <th>Created</th>
>    </tr>
>    <!-- Here is where we loop through our $posts array, printing out
> post info -->
>    <?php foreach ($posts as $post): ?>
>    <tr>
>    <td><?php echo $post['Post']['id']; ?></td>
>    <td>
>    <?php echo $this->Html->link($post['Post']['title'],
>    array('controller' => 'posts', 'action' => 'view', $post['Post']
> ['id'])); ?>
>    </td>
>    <td><?php echo $post['Post']['created']; ?></td>
>    </tr>
>    <?php endforeach; ?>
> 
>   </table>
> 
> I get this error:
> 
> Cannot modify header information - headers already sent by (output
> started at C:\xampp\htdocs\cakephp\app\controllers
> \posts_controller.php:1) [CORE\cake\libs\controller\controller.php,
> line 746]
> 
> 
> Can someone enlighten me ?
> 
> 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 [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

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