23:33
Этот коммит содержится в:
@@ -6,10 +6,10 @@
|
||||
* Time: 00:18
|
||||
*/
|
||||
|
||||
namespace PTEST\Controller;
|
||||
namespace PTEST\C;
|
||||
|
||||
|
||||
class CAPTCHA {
|
||||
class CAPTCHAController {
|
||||
|
||||
public function indexAction() {
|
||||
|
||||
|
@@ -6,15 +6,21 @@
|
||||
* Time: 00:16
|
||||
*/
|
||||
|
||||
namespace PTEST\Controller;
|
||||
namespace PTEST\C;
|
||||
|
||||
|
||||
use PFRM\Controller;
|
||||
use PFRM\View as View;
|
||||
|
||||
class Index extends Controller {
|
||||
class IndexController extends Controller {
|
||||
|
||||
public function indexAction() {
|
||||
print "index action";
|
||||
$view = new View('index');
|
||||
$view->page_title = "Доска объявлений";
|
||||
$view->render();
|
||||
}
|
||||
|
||||
public function pageAction( $numder ) {
|
||||
print "number = ".$numder;
|
||||
}
|
||||
}
|
21
src/C/error404Controller.php
Обычный файл
21
src/C/error404Controller.php
Обычный файл
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Игорь
|
||||
* Date: 23.01.2017
|
||||
* Time: 18:04
|
||||
*/
|
||||
|
||||
namespace PTEST\C;
|
||||
use PFRM\Controller;
|
||||
use PFRM\View as View;
|
||||
|
||||
class error404Controller extends Controller{
|
||||
|
||||
public function indexAction() {
|
||||
$view = new View('404');
|
||||
$view->setHTTPHeader('HTTP/1.0 404 Not Found');
|
||||
$view->render();
|
||||
}
|
||||
|
||||
}
|
@@ -9,7 +9,7 @@
|
||||
namespace PTEST\Model;
|
||||
|
||||
|
||||
class Ad {
|
||||
class AdModel {
|
||||
|
||||
protected $id;
|
||||
|
||||
|
6
src/V/404.php
Обычный файл
6
src/V/404.php
Обычный файл
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
$this->page_title = "Ошибка: 404 Страница не найдена";
|
||||
|
||||
require __DIR__ . '/inc/head.php';
|
||||
require __DIR__ . '/inc/body.php';
|
14
src/V/inc/body.php
Обычный файл
14
src/V/inc/body.php
Обычный файл
@@ -0,0 +1,14 @@
|
||||
<body class="page">
|
||||
<div class="page__container">
|
||||
<header class="header">
|
||||
<h1 class="header__title"><?php echo $this->site_name; ?></h1>
|
||||
</header>
|
||||
<section role="main">
|
||||
<h1><?php echo $this->page_title; ?></h1>
|
||||
</section>
|
||||
<footer>
|
||||
<?php require 'footer.php'; ?>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
1
src/V/inc/footer.php
Обычный файл
1
src/V/inc/footer.php
Обычный файл
@@ -0,0 +1 @@
|
||||
<?php echo "© ".date('Y');?>г. Igor V Belousov
|
8
src/V/inc/head.php
Обычный файл
8
src/V/inc/head.php
Обычный файл
@@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru-RU">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
<script src="/js/script.js"></script>
|
||||
<title><?php echo $this->page_title; ?></title>
|
||||
</head>
|
3
src/V/index.php
Обычный файл
3
src/V/index.php
Обычный файл
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
require __DIR__ . '/inc/head.php';
|
||||
require __DIR__ . '/inc/body.php';
|
@@ -8,8 +8,27 @@
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use \PFRM\App;
|
||||
|
||||
$app = new App();
|
||||
$app->setRoute('/^CAPCHA.png$/','CAPTCHA');
|
||||
setlocale(LC_ALL,'ru_RU.UTF-8');
|
||||
|
||||
$app = new PFRM\App();
|
||||
|
||||
$app->config = (object) [
|
||||
"views_dir" => __DIR__ . '/V/',
|
||||
"public_dir" => dirname(__DIR__) . '/public/',
|
||||
"db" => (object) [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => '3306',
|
||||
'dbname' => 'test',
|
||||
'user' => 'testuser',
|
||||
'password' => 'testpassword',
|
||||
],
|
||||
"controller_namespace" => "\\PTEST\\C\\",
|
||||
"site_name" => "Доска объявлений"
|
||||
];
|
||||
|
||||
$app->setRoute( '/^\/CAPTCHA.png$/', 'CAPTCHA' );
|
||||
$app->setRoute( '|^/page/(?<id>\d+)/$|', 'Index', 'page');
|
||||
$app->setRoute( '/^.*$/', 'error404' );
|
||||
|
||||
$app->run();
|
Ссылка в новой задаче
Block a user