view page - error PHP

2019-09-10 02:31发布

问题:

i'm watching a tutorial i'm watching a tutorials about CMS with OOP - PHP

but while opening the users.php ( view page) i don't get any result !

on control page

users.php

<?php


/**
 * Globals file
 */
require_once('../globals.php');

/**
 * Articles Controller
 */
require_once(CONTROLLERS.'UsersController.php');

/**
 * Models
 */
require_once(MODELS.'UsersModel.php');



$usersmod = new UsersModel();

/**
 * Controller Instance
 */
$controller = new UsersController($usersmod);

$controller->GetAllUsers();

?>

users.html

{include="header"}

<!--main content start-->
<section id="main-content">
    <section class="wrapper">
        <!-- page start-->
        <div class="row">
            <div class="col-sm-12">
                <section class="panel">
                    <header class="panel-heading">
                        Users
                    </header>

                    <table class="table">
                        <thead>
                        <tr>
                            <th>id</th>
                            <th>name</th>
                            <th>Username</th>
                            <th>email</th>
                            <th>is admin?</th>
                            <th>Control</th>
                        </tr>
                        </thead>
                        <tbody>
                        {loop="users"}
                        <tr>
                            <td>{$value.id}</td>
                            <td>{$value.name}</td>
                            <td>{$value.username} </td>
                            <td>{$value.email}</td>
                            <td>{$value.is_admin}</td>
                            <td>
                                <a href="updateuser.php?id={$value.id}" class="btn btn-primary">Update</a>
                                <a href="deleteuser.php?id={$value.id}" class="btn btn-danger">Delete</a>
                            </td>
                        </tr>
                        {/loop}

                        </tbody>
                    </table>
                </section>
            </div>
        </div>
    </section>
</section>


{include="footer"}

UsersController.php

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);   

class UsersController
{

    private $usersModel ; // object from model

    public function __construct(UsersModel $usersmod)
    {

        $this->usersModel = $usersmod ;


    }


    /**********************Admin Area**********************/


    public function GetAllUsers()
    {

        $users = $this->usersModel->Get();

        System::Get('tpl')->assign('users',$users);
        System::Get('tpl')->assign('users');
    }

}


?>

UsersModel.php

class UsersModel
{

    private $userInfo = array();

    /**
     * Add New user
     * @param $data
     * @return bool
     */
        public function Add($data)
        {
            if(System::Get('db')->Insert('users',$data))
                return TRUE;

            return FALSE;
        }


    /**
     * Get All Users
     */
        public function Get($extra = '')
        {
            $users = array();

            System::Get('db')->Execute("SELECT * FROM `users` {$extra}");
            if(System::Get('db')->AffectedRows()>0)
                $users = System::Get('db')->GetRows();

            return $users;
        }

i just get white page (blank)

no result

标签: php html oop