Reputation: 133
I want print my name in cakephp 2, but i have error ' Error: The view for ItemsController::index() was not found.' , how can i fix problem?
my controller :
<?php
class ItemsController extends AppController {
public function index(){
$this->set('data','waad');
}
}
?>
my view/index.ctp :
<?php
echo $data
?>
Upvotes: 1
Views: 652
Reputation: 132
You need to make an index.ctp file inside Templates/Items/ Here Items would be the folder corresponding to your ItemsController
You can easily bake templates, controllers and models in cakephp 3 by writing commands in your console like:
.\bin\cake bake controller ItemsController .\bin\cake bake model Items .\bin\cake bake template Items
Cakephp would bake everything for you! Hope this helps :)
Upvotes: 3