views:

77

answers:

3

Warning (2): Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/iframeworking/iframe/app/models/frame.php:7) [COREcake/libs/controller/controller.php, line 647]

here is the code from frame.php:

<?php
class Frame extends AppModel
{
    var $name = 'Frame';
var $belongsTo = array('User' => array('className' => 'User', 'dependent' => true));
}
?> 
A: 

You are making an output to the web browser in /models/frame.php line 7. That is probably too early in the process - I don't know Cake, but I presume the model files should contain model classes only and no "active" code.

Note that even white space before the <? or <?php counts as output.

Pekka
A: 

You have a whitespace after '?>' at the bottom. Removing that will fix the problem.

fahad19
+2  A: 

You probably have a whitespace after your php closing tag (?>).

My recommendation is to make it a habit not to close your PHP tags in your controllers and models (and other PHP-only files). PHP parser does not require the closing tag at the end of the file (it is implied) and it will save you from headaches in the future (even though it will look "funny" at first).

In other words, this should fix it:

<?php
class Frame extends AppModel
{
    var $name = 'Frame';
    var $belongsTo = array('User' => array(/*...*/);
}
dr Hannibal Lecter
+1, didn't know this. In fact, a recent build of Eclipse PDT started doing this with new PHP files, and I thought it was a bug!
Daniel Wright