コード例 #1
0
ファイル: edit.php プロジェクト: andreich22/mvc_oop_blog
include_once 'startup.php';
include_once 'model/m_view.php';
include_once 'model/m_base.php';
// Установка параметров, подключение к БД, запуск сессии.
startup();
// Извлечение статей.
$articles = articles_edit_only();
// Обработка отправки формы.
if (!empty($_POST)) {
    if (articles_edit_post($_POST['title'], $_POST['content'], $_POST['date'], $_POST['autor'])) {
        header('Location: editor.php');
        die;
    }
    $title = $_POST['title'];
    $content = $_POST['content'];
    $error = true;
} else {
    $title = '';
    $content = '';
    $error = false;
}
// Кодировка.
header('Content-type: text/html; charset=utf-8');
print_r($articles);
// Внутренний шаблон.
$content = view_include_all('theme/v_edit.php', $articles);
// Внешний шаблон.
$page = view_include('theme/v_base.php', array('title1' => 'Редактировать статью', 'content' => $content));
// Вывод.
echo $page;
コード例 #2
0
ファイル: delete.php プロジェクト: andreich22/mvc_oop_blog
<?php

include_once 'startup.php';
include_once 'model/m_view.php';
include_once 'model/m_base.php';
// Установка параметров, подключение к БД, запуск сессии.
startup();
// Обработка отправки формы.
if (!empty($_GET['id'])) {
    articles_delete($_GET['id']);
    $message['echo'] = 'удалили cтатью id' . $_GET['id'];
} else {
    header('Location: index.php');
}
// Кодировка.
header('Content-type: text/html; charset=utf-8');
//Вывод в шаблон.
// Внутренний шаблон.
$content = view_include('theme/v_delete.php', $message);
// Внешний шаблон.
$page = view_include('theme/v_base.php', array('title1' => 'Успешное удаление статьи', 'content' => $content));
// Вывод.
echo $page;
コード例 #3
0
ファイル: editor.php プロジェクト: andreich22/mvc_oop_blog
<?php

include_once 'startup.php';
include_once 'model/m_view.php';
include_once 'model/m_base.php';
// Установка параметров, подключение к БД, запуск сессии.
startup();
// Извлечение статей.
$articles = articles_all();
// Кодировка.
header('Content-type: text/html; charset=utf-8');
// Внутренний шаблон.
$content = view_include_all('theme/v_editor.php', $articles);
// Внешний шаблон.
$page = view_include('theme/v_base.php', array('title1' => 'Консоль редактора', 'content' => $content));
// Вывод.
echo $page;
コード例 #4
0
ファイル: new.php プロジェクト: andreich22/mvc_oop_blog
<?php

include_once 'startup.php';
include_once 'model/m_view.php';
include_once 'model/m_base.php';
// Установка параметров, подключение к БД, запуск сессии.
startup();
// Обработка отправки формы.
if (!empty($_POST)) {
    if (articles_new($_POST['title'], $_POST['text'])) {
        header('Location: editor.php');
        die;
    }
    $articles['title'] = $title = $_POST['title'];
    $articles['text'] = $text = $_POST['text'];
    $articles['error'] = true;
} else {
    $articles['title'] = '';
    $articles['text'] = '';
    $articles['error'] = false;
}
//	var_dump($articles);
// Кодировка.
header('Content-type: text/html; charset=utf-8');
// Внутренний шаблон.
$content = view_include('theme/v_new.php', $articles);
// Внешний шаблон.
$page = view_include('theme/v_base.php', array('title1' => 'Новая статья добавить', 'content' => $content));
// Вывод.
echo $page;
コード例 #5
0
ファイル: index.php プロジェクト: TTeRMiTT/php2
<?php

require_once "models/models.php";
require_once "models/list.php";
require_once "views/main.php";
$link = connect_db($host, $login, $pass, $db);
require_once "models/list.php";
close_db($link);
// Внутренний шаблон.
$content = view_include('v_index.php');
// Внешний шаблон.
$page = view_include('v_main.php', array('title' => $title, 'content' => $content));
// Вывод.
echo $page;