Monday, July 2, 2012

Re: syntax error, unexpected T_CLASS

<? php 

it should be <?php

check line 1 :)
--
Lep pozdrav, Tilen Majerle



2012/7/3 David Lozzi <david@lozzi.net>
Hi There,

I'm new to PHP. I installed PHP/MySql using Xampp. I downloaded CakePHP into a directory called caketest. When I land on the home page I get two red issues around security (blog tutorial said that's optional), all green except for database connectivity. 

I walked through the blog tutorial, created the model, controller and view. I am now getting an error

Fatal Error
 
Error: syntax error, unexpected T_CLASS 
File: C:\xampp\htdocs\caketest\app\Controller\PostsController.php 
Line: 2

When i hit localhost/caketest/posts. Here's what the code looks like in the controller

<? php
class PostsController extends AppController {   <-- LINE 2
    public $helpers = array('Html','Form');
    
    public function index(){
        $this->set('posts',$this->Post->find('all'));  
    }
    
    public function view($id = null){
        $this->Post->id = $id;
        $this->set('post', $this->Post->read());
    }
}
?>

I'm guessing the error does not have to do with the database connection issue I have (I am working on resolving that now). 

Thanks!
David

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
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

No comments: