<MyRusakov.ru />

Программирование на C++ в Unreal Engine 5

Программирование на C++ в Unreal Engine 5

Данный курс научит Вас созданию игр на C++ в Unreal Engine 5. Курс состоит из 12 разделов, в которых Вас ждёт теория и практика. Причём, в качестве практики будет создан весьма крупный проект объёмом свыше 5000 строк качественного кода, который уже на практике познакомит Вас с принципами создания игр на C++ в Unreal Engine 5.

Параллельно с курсом Вы также будете получать домашние задания, результатом которых станет, в том числе, полноценная серьёзная работа для портфолио.

Помимо самого курса Вас ждёт ещё и очень ценный Бонус: «Тестирование Unreal-проектов на Python», в рамках которого Вы научитесь писать очень полезные тесты для тестирования самых разных аспектов разработки игр.

Подробнее
Подписка

Подпишитесь на мой канал на YouTube, где я регулярно публикую новые видео.

YouTube Подписаться

Подписавшись по E-mail, Вы будете получать уведомления о новых статьях.

Подписка Подписаться

Добавляйтесь ко мне в друзья ВКонтакте! Отзывы о сайте и обо мне оставляйте в моей группе.

Мой аккаунт Мой аккаунт Моя группа
Опрос

Какая тема Вас интересует больше?

Форум сайта MyRusakov.ru

проблема с уроком 8 Создание главной страницы
28.01.2014 19:28:52 проблема с уроком 8 Создание главной страницы Сообщение #1
Andreafbi

Andreafbi

Новичок

Новичок

Дата регистрации:
14.08.2013 22:03:01

Сообщений: 3

вместо страницы у меня выводит лишь слово "main" ошибку ищу уже неделю не могу найти.
<?php
require_once "config_class.php";
require_once "article_class.php";
require_once "section_class.php";
require_once "user_class.php";
require_once "menu_class.php";
require_once "banner_class.php";
require_once "message_class.php";

abstract class Modules{

protected $config;
protected $article;
protected $section;
protected $user;
protected $menu;
protected $banner;
protected $message;
protected $data;

public function __construct($db){
session_start();
$this->config=new Config($db);
$this->article=new Article($db);
$this->section=new Section($db);
$this->user=new User($db);
$this->menu=new Menu($db);
$this->banner=new Banner($db);
$this->message=new Message();

$this->data=$this->secureData($_GET);
}

public function getContent() {
$sr["title"]=$this->getTitle();
$sr["meta_desc"]=$this->getDescription();
$sr["meta_key"]=$this->getKeyWords();
$sr["menu"]=$this->getMenu();
$sr["auth_user"]=$this->getAuthUser();
$sr["banners"]=$this->getBanners();
$sr["top"]=$this->getTop();
$sr["middle"]=$this->getMiddle();
$sr["bottom"]=$this->getBottom();
return $this-> getReplaceContent($sr,"main";
}

abstract protected function getTitle();
abstract protected function getDescription();
abstract protected function getKeyWords();
abstract protected function getMiddle();

protected function getTop(){
return "";
}

protected function getBottom(){
return "";
}

protected function getMenu(){
$menu=$this->menu->getAll();
for ($i=0; $i<count($menu); $i++){
$sr["title"]=$menu[$i]["title"];
$sr["link"]=$menu[$i]["link"];
$text.=$this->getReplaceTemplate($sr,"menu_item";
}
return $text;
}

protected function getAuthUser(){
$sr["message_auth"]="";
return $this->getReplaceTemplate($sr,"form_auth";
}
protected function getBanners(){
$banners=$this->banner->getAll();
for ($i=0; $i<count($menu); $i++){
$sr["code"]=$banners[$i]["code"];
$text.=$this->getReplaceTemplate($sr,"banner";
}
return $text;
}

private function secureData($data){
foreach($data as $key=>$value){
if (is_array($value)) $this->secureData($value);
else $data[$key]=htmlspecialchars($value);
}
return $data;
}
/*методы шаблонизатора*/

protected function getTemplate($name){
$text=file_get_contents($this->config->dir_tmpl.$name.".tpl";
/*делаем замену %address% в файле .tmp*/
return str_replace("%address%", $this->config->address, $text);
}
/*функция позволяющая заменять %...% получив массив*/
protected function getReplaceTemplate($sr, $template){
return $this->getReplaceContent($sr, $this->getTemplate($template));
}
private function getReplaceContent($sr, $content){
$search=array();/*элементы которые хотим найти*/
$replace=array();/*массив с элементами на которые мы собираемся заменить*/
$i=0;
foreach($sr as $key=>$value){
$search[$i]=$key;
$replace[$i]=$value;
$i++;
}
return str_replace($search, $replace, $content);
}
}



?>

<?php
require_once "modules_class.php";

class FrontPageContent extends Modules{

private $articles;
private $page;

public function __construct($db){
parent::__construct($db);
$this->articles=$this->article->getAllSortData();
/*проверяем указанали страница в строке поска браузера*/
$this->page=(isset($this->data["page"]))? $this->data["page"]:1;

}
protected function getTitle(){

}

protected function getDescription(){

}

protected function getKeyWords(){

}

protected function getMiddle(){

}
}
?>

<?php
/*устанавливаем внутреннюю кодировку на сайте*/
mb_internal_encoding("UTF-8";
require_once "lib/database_class.php";
require_once "lib/frontpagecontent_class.php";
/*создаем экземпляры этих объектов*/
$db=new DataBase();
/*получаем view из GET параметров*/
$view=$_GET["view"];
switch ($view){
case "":
$content=new FrontPageContent($db);
break;
default: exit;
}

echo $content->getContent();
?>
Профиль
29.01.2014 08:05:25 проблема с уроком 8 Создание главной страницы Сообщение #2
LLIMATKO

LLIMATKO

Эксперт

Эксперт

Дата регистрации:
12.02.2013 15:31:03

Сообщений: 129

Ошибка , которая мне в глаза попала сразу, у Вас герРеплейсКонтент реализован не правильно. Кидаю правильный

private function getReplaceContent($sr, $content) {
$search = array(); //елементы, которые хотим найти
$replace = array(); //элементы на которые хотим поменять
$i=0;
foreach ($sr as $key => $value) {
$search[$i] = "%$key%"; //то что хотим найти находится в key
$replace[$i] = $value; // на что хотим поменять в value
$i++;
}
return str_replace($search, $replace, $content);
}


а так по вашему коду трудно прочесть что-либо. Высылайте нормально код или присылайте файлы, будет время погляжу
Профиль
29.01.2014 08:19:02 проблема с уроком 8 Создание главной страницы Сообщение #3
Andreafbi

Andreafbi

Новичок

Новичок

Дата регистрации:
14.08.2013 22:03:01

Сообщений: 3

куда высылать файлы?
Профиль
29.01.2014 08:38:03 проблема с уроком 8 Создание главной страницы Сообщение #4
LLIMATKO

LLIMATKO

Эксперт

Эксперт

Дата регистрации:
12.02.2013 15:31:03

Сообщений: 129

[email protected] - все файлы и БД
Профиль
30.01.2014 16:27:37 проблема с уроком 8 Создание главной страницы Сообщение #5
LLIMATKO

LLIMATKO

Эксперт

Эксперт

Дата регистрации:
12.02.2013 15:31:03

Сообщений: 129

У вас не правильно прописаны следующие элементы

функция getContent:
return getReplaceTemplate , а вы что пишите?

так же не правильная функция getReplaceContent , но ее я уже кидал на форуме
Профиль
31.01.2014 22:38:43 проблема с уроком 8 Создание главной страницы Сообщение #6
Andreafbi

Andreafbi

Новичок

Новичок

Дата регистрации:
14.08.2013 22:03:01

Сообщений: 3

спасибо за помощь, нашел помимо всего ощибку в методе select
Профиль
28.05.2014 15:57:09 проблема с уроком 8 Создание главной страницы Сообщение #7
bachexa

bachexa

Новичок

Новичок

Дата регистрации:
28.05.2014 15:51:48

Сообщений: 1

Notice: Undefined index: view in C:\xampp\htdocs\www\phpsaitinolidan\index.php on line 6

Notice: Undefined variable: text in C:\xampp\htdocs\www\phpsaitinolidan\lib\modules_class.php on line 53

Notice: Undefined variable: text in C:\xampp\htdocs\www\phpsaitinolidan\lib\modules_class.php on line 69
у мина ест вот такие ошибки 


вот мои код 
<?
require_once "config_class.php";
require_once "section_class.php";
require_once "articles_class.php";
require_once "menu_class.php";
require_once "banners_class.php";
require_once "message_class.php";
abstract class Modules{
protected $config;
protected $section;
protected $articles;
protected $menu;
protected $banners;
protected $message;
protected $data;

public function __construct($db){
$this->config = new config();
$this->section = new Section($db);
$this->articles = new Article($db);
$this->menu = new Menu($db);
$this->banners = new Banner($db);
$this->message = new Message($db);
$this->data = $this->secureData($_GET);
}

public function getContent(){
$sr["title"]=$this->getTitle();
$sr["meta_desc"]=$this->getDescription();
$sr["meta_key"]=$this->getKeyword();
$sr["menu"]=$this->getMenu();
$sr["auth_user"]=$this->getAuthUser();
$sr["baners"]=$this->getBanners();
$sr["top"]=$this->getTop();
$sr["midle"]=$this->getMidle();
$sr["bottom"]=$this->getBottom();
return $this->getReplaceTemplate($sr,"main";
}


abstract protected function getTitle();
abstract protected function getDescription();
abstract protected function getKeyword();
abstract protected function getMidle();


protected function getMenu() {
            $menu = $this->menu->getAll();
            for ($i = 0; $i < count($menu); $i++) {
                $sr["title"] = $menu[$i]["title"];
                $sr["link"] = $menu[$i]["link"];
                $text .= $this->getReplaceTemplate($sr, "menu_item";
            }
            return $text;
        }


protected function getAuthUser(){
$sr["mesage_auth"]="";
return $this->getReplaceTemplate($sr,"form_auth";
}


protected function getBanners(){
$banners = $this->banners->getAll();
for($i=0;$i<count($banners);$i++){
$sr["code"]=$banners[$i]["code"];
$text .=$this->getReplaceTemplate($sr,"baner";
}

return $text;
}

protected function getTop(){
return "";
}


protected function getBottom(){
return "";
}
 

private function secureData($data){
foreach ($data as $key=>$value){
if(is_array($value)) $this->secureData($value);
else $data[$key]=htmlspecialchars($value);
}
return $data;
}

protected function getTemplate($name){
$text = file_get_contents($this->config->dir_tmp.$name.".tpl";
return str_replace("%address%",$this->config->address,$text);
}

protected function getReplaceTemplate($sr,$template){
return $this->getReplaceContent($sr,$this->getTemplate($template));
}
private function getReplaceContent($sr,$content){
$search = array();
$replace = array();
$i=0;
foreach ($sr as $key=>$value){
$search[$i] = "%$key%";
$replace[$i] = $value;
$i++;
}
return str_replace($search,$value,$content);
}

}
?>



<?
require_once "lib/database_class.php";
require_once "lib/frontpagecontent_class.php";
$db = new database();
$view = $_GET["view"];
switch($view){
case "":
 $content = new FrontPage($db);
break;
default:exit; 
}

echo $content->getContent();
?>

если смойите пршу памагите наити ашибку
Профиль