php - controller/model code appearing at top of page in cakePHP -
i'm following cakephp "getting started" here:
http://book.cakephp.org/2.0/en/getting-started.html
one thing got stuck on created model, controller, , view posts eg:
<docroot>/app/controller/postscontroller.php <docroot>/app/model/post.php <docroot>/app/view/posts/index.ctp
exactly outlined in link above. problem getting error:
error: postscontroller not found.
and controller code being printed @ top of page.
i figured out had add
<?php [code] ?>
around code tutorial specified controller file. ie intstead of:
class postscontroller extends appcontroller { public $helpers = array('html', 'form'); public function index() { $this->set('posts', $this->post->find('all')); } }
i had:
<?php class postscontroller extends appcontroller { public $helpers = array('html', 'form'); public function index() { $this->set('posts', $this->post->find('all')); } } ?>
once did that, worked, kinda. except getting model "code" printed @ top of page. surrounding that php escape (as in controller above) resolved issue, i'm concerned hinting i've misconfigured while setting cake.
my question: tutorial wrong? why not specify use of php escapes (or whatever call things) if needed stuff working? or, if should not needed, can suggest reason in case needed? maybe i've mis-configured before step...
thanks, looked similar question on unable locate one, please feel free direct me if duplicate...
my question: tutorial wrong? why not specify use of php escapes (or whatever call things) if needed stuff working?
the tutorials expect bare minimum of basic php knowledge. might want start here reading basic php tags. won't far cakephp if don't know @ least basic php, object oriented programming , understanding of oop design pattern called mvc - model view controller.
in php file definitly need starting tag <?php
not want close it. reasons check answer:
Comments
Post a Comment