Example #1
0
 /**
  * @param DefaultModel $model
  */
 public function __construct(DefaultModel $model)
 {
     parent::__construct($model);
     $this->model = $model;
 }
Example #2
0
<?php

$model = new IndexModel();
$view = new IndexView($model);
$view->display("index.tpl");
Example #3
0
 * @link 		http://simp.la
 * @author 		Denis Pikusov
 *
 */
error_reporting(E_ALL);
// Засекаем время
$time_start = microtime(true);
session_start();
// Определяем реальный IP адрес посетителя
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
require_once 'view/IndexView.php';
$view = new IndexView();
// Если все хорошо
if (($res = $view->fetch()) !== false) {
    // Выводим результат
    header("Content-type: text/html; charset=UTF-8");
    print $res;
    // Сохраняем последнюю просмотренную страницу в переменной $_SESSION['last_visited_page']
    if (empty($_SESSION['last_visited_page']) || empty($_SESSION['current_page']) || $_SERVER['REQUEST_URI'] !== $_SESSION['current_page']) {
        if (!empty($_SESSION['current_page']) && $_SESSION['last_visited_page'] !== $_SESSION['current_page']) {
            $_SESSION['last_visited_page'] = $_SESSION['current_page'];
        }
        $_SESSION['current_page'] = $_SERVER['REQUEST_URI'];
    }
} else {
    // Иначе страница об ошибке
    header("http/1.0 404 not found");
Example #4
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/Controllers/DefaultController.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/Model/DefaultModel.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/View/IndexView.php';
#include_once('Translate.php');
//initiate the triad
$model = new DefaultModel();
//It is important that the controller and the view share the model
$controller = new DefaultController($model);
$view = new IndexView($model);
$controller->actionGetHeaderCart();
$view->getIndexPage();