Добрый день!
При попытке зайти на главную страницу сайта появляется ошибка:
Warning: include(C:\OSPanel\domains\test\www\rusakov\tmplmain.tpl): failed to open stream: No such file or directory in C:\OSPanel\domains\test\www\rusakov\core\view_class.php on line 14
Warning: include(): Failed opening 'C:\OSPanel\domains\test\www\rusakov\tmplmain.tpl' for inclusion (include_path='.;c:/ospanel/modules/php/PHP_7.2-x64;c:/ospanel/modules/php/PHP_7.2-x64/PEAR/pear;core;controllers') in C:\OSPanel\domains\test\www\rusakov\core\view_class.php on line 14
Строка 14:
Файл view_class.php:
Файл start.php, в котором содержится путь к папке tmpl:
Скажите, пожалуйста где ошибка в коде?
Содержимое папки tmpl:
При попытке зайти на главную страницу сайта появляется ошибка:
Warning: include(C:\OSPanel\domains\test\www\rusakov\tmplmain.tpl): failed to open stream: No such file or directory in C:\OSPanel\domains\test\www\rusakov\core\view_class.php on line 14
Warning: include(): Failed opening 'C:\OSPanel\domains\test\www\rusakov\tmplmain.tpl' for inclusion (include_path='.;c:/ospanel/modules/php/PHP_7.2-x64;c:/ospanel/modules/php/PHP_7.2-x64/PEAR/pear;core;controllers') in C:\OSPanel\domains\test\www\rusakov\core\view_class.php on line 14
Строка 14:
PHP:
include($template);
PHP:
class View {
private $dir_tmpl;
public function __construct($dir_tmpl){
$this->dir_tmpl = $dir_tmpl;
}
public function render($file, $params, $return = false) {
$template = $this->dir_tmpl.$file.'.tpl';
extract($params);
ob_start();
include($template);
if ($return) return ob_get_clean();
echo ob_get_clean();
}
}
PHP:
<?php
set_include_path(get_include_path().PATH_SEPARATOR.'core'.PATH_SEPARATOR.'controllers');
spl_autoload_extensions('_class.php');
spl_autoload_register();
define('DIR_TMPL', 'C:\OSPanel\domains\test\www\rusakov\tmpl');
define('MAIN_LAYOUT', 'main');
?>
Содержимое папки tmpl:
Вложения
-
16,9 КБ Просмотры: 26