-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Olá, faço o curso php 7 completo pela udemy e não estou conseguindo avançar no curso, Volta e meia dá erro. E escrevo o código igual ao da aula, então se puder ajudar agradeço.
Agora deu esse erro:
Slim Application Error
The application could not run because of the following error:
Details
Message: Template header not found!
File: C:\XAMPP\htdocs\Ecommerce\vendor\rain\raintpl\library\Rain\Tpl.php
Line: 191
Trace
#0 C:\XAMPP\htdocs\Ecommerce\vendor\rain\raintpl\library\Rain\Tpl.php(79): Rain\Tpl->checkTemplate('header')
#1 C:\XAMPP\htdocs\Ecommerce\vendor\hcodebr\php-classes\src\Page.php(32): Rain\Tpl->draw('header')
#2 C:\XAMPP\htdocs\Ecommerce\index.php(14): Hcode\Page->__construct()
#3 [internal function]: {closure}()
#4 C:\XAMPP\htdocs\Ecommerce\vendor\slim\slim\Slim\Router.php(200): call_user_func_array(Object(Closure), Array)
#5 C:\XAMPP\htdocs\Ecommerce\vendor\slim\slim\Slim\Slim.php(1210): Slim\Router->dispatch(Object(Slim\Route))
#6 C:\XAMPP\htdocs\Ecommerce\vendor\slim\slim\Slim\Middleware\Flash.php(86): Slim\Slim->call()
#7 C:\XAMPP\htdocs\Ecommerce\vendor\slim\slim\Slim\Middleware\MethodOverride.php(94): Slim\Middleware\Flash->call()
#8 C:\XAMPP\htdocs\Ecommerce\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#9 C:\XAMPP\htdocs\Ecommerce\vendor\slim\slim\Slim\Slim.php(1159): Slim\Middleware\PrettyExceptions->call()
#10 C:\XAMPP\htdocs\Ecommerce\index.php(18): Slim\Slim->run()
#11 {main}
Segue arquivos php para olharem:
[] ]; public function __construct($opts = array()) { $this->options = array_merge($this->defaults, $opts); $config = array( "tpl_dir" => $_SERVER["DOCUMENT_ROOT"] . "/views/", "cache_dir" => $_SERVER["DOCUMENT_ROOT"] . "/views-cache/", "debug" => false // set to false to improve the speed ); Tpl::configure($config); $this->tpl = new Tpl; $this->setData($this->options["data"]); $this->tpl->draw("header"); } private function setData($data = array()) { foreach ($data as $key => $value) { $this->tpl->assign($key, $value); } } public function setTpl($name, $data = array(), $returnHTML = false) { $this->setData($data); return $this->tpl->draw($name, $returnHTML); } public function __destruct() { $this->tpl->draw("footer"); } } e INDEX.PHP: config('debug', true); $app->get('/', function () { $page = new Page(); $page->setTpl("index"); }); $app->run(); Obrigado