you...
On Nov 24, 5:04 pm, Amit Badkas <amit.sanis...@gmail.com> wrote:
> Hi,
>
> The error message says *output started at
> C:\xampp\htdocs\cakephp\app\controllers\posts_controller.php:1*
>
> It means the first line of posts_controller.php has some type of output,
> maybe a space or an empty line, please check.
>
> Amit Badkas
>
> PHP Applications for E-Biz:http://www.sanisoft.comOn Tue, Nov 23, 2010 at 9:56 PM, John Maxim <sunway...@gmail.com> 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 sitehttp://cakeqs.organd 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 cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@googlegroups.com>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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment