I building my first cake PHP application, all things configured correctly, but when i calling to model on controller as below it gives an error message when i browse this url on localhost
class NotesController extends AppController{
var $name = "Notes";
function index(){
$this->set('notes',$this->Note->find('all'));
}
}
this gives an error like this.
Parse error: syntax error, unexpected T_STRING, expecting T_FUNCTION in D:\wamp\www\cakephp\app\Model\note.php on line 4
my model file has follow codes
class Note extends AppModel{
$name = "Note";
}
i think db connection and other configurations are ok,please any one can help me, i ll highly appreciated you. thanks lot….
Change:
To:
or:
CakePHP recommends using
varto keep code compatible with PHP4. However, this is completely unnecessary and it’s better to usepublic.That being said, the code you posted should not give an
unexpected T_STRINGerror but, rather, anunexpected T_VARIABLEerror. So there may be something else going on as well.