I am new in cakephp 3.0 Now, What am I trying If I have any HTML template So, How can I integrate with cakephp.

Here, I am creating a controller: UsersController

src/controller

<?php
    namespace App\Controller;
    use App\Controller\AppController;
    use Cake\ORM\TableRegistry;

    class UsersController extends AppController{
        public function index(){
             $this->layout='index';
        }
    }
?>

config/routes.php

$routes->connect('/', ['controller' => 'Users', 'action' => 'display', 'home']);
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);

src/Template/Layout: index.ctp

<html>
<head>
    <?php echo $this->Html->charset(); ?>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <title>Insqft</title>
    <?php $this->Html->css('bootstrap.min.css'); ?>
</head>
<body>
    <h1>Welcome Cakephp</h1>
    <?php $this->Html->script('js/bootstrap.min.js'); ?>
</body>
</html>

When I open this on localhost then It show an error i.e. Error: Create UsersController::display() in file: src\Controller\UsersController.php.. So, How can I do this? Please help me.

Thank You

0 Answers