More changes

This commit is contained in:
2019-04-29 17:28:24 -03:00
parent e696e99c4c
commit 64e2b0c6e7
10 changed files with 47 additions and 74 deletions
@@ -67,6 +67,10 @@ class Output {
return $this; return $this;
} }
public function addValue($key, $value){
$this->view['values'][$key] = $value;
}
public function render() { public function render() {
if(!is_file(__DIR__."/classes/".strtolower($this->_template)."/".$this->_template.'.php') ){ if(!is_file(__DIR__."/classes/".strtolower($this->_template)."/".$this->_template.'.php') ){
$this->_template = 'DefaultTemplate'; $this->_template = 'DefaultTemplate';
@@ -10,11 +10,14 @@ class DefaultTemplate extends RenderableTemplate {
public function render() { public function render() {
if (is_file($this->getView()['location'])) { $this->content = file_get_contents(__DIR__ . '/template.html');
$this->content = file_get_contents($this->getView()['location']);
$this->implate();
}
if(is_file($this->getView()['location'])){
$this->content = str_replace('{{>content}}', $this->replaceSections(file_get_contents($this->getView()['location']), $this->_view['values']), $this->content);
}else{
$this->content = str_replace('{{>content}}', '', $this->content);
}
$this->implate();
} }
} }
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
{{>content}}
</body>
</html>
@@ -0,0 +1,20 @@
<?php
use Template\RenderableTemplate as RenderableTemplate;
class NullTemplate extends RenderableTemplate {
public function __construct() {
}
public function render() {
if (is_file($this->getView()['location'])) {
$this->content = file_get_contents($this->getView()['location']);
$this->implate();
}
}
}
@@ -1,24 +0,0 @@
<body>
<div id="wrapper">
<!-- Sidebar -->
{{sidebar}}
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div id="main-page-wrapper">
{{header}}
<div id="progress" class="progress hidden" >
<div class="progress-bar progress-bar-striped progress-bar-animated active" style="width: 100%;"></div>
</div>
<!-- BreadCrumbs -->
<!-- /BreadCrumbs -->
<div id="page-content-wrapper">
<div class="container-fluid" style="height: 1024px;">
<div class="row">
<div id="content" class="col-lg-12">
@@ -1,10 +0,0 @@
</div>
</div>
</div>
</div>
</div>
<!-- /#page-content-wrapper -->
</div>
{{footer}}
</body>
@@ -1,17 +0,0 @@
<header style='min-height: 50px; background-color: #000;'>
<ul class="nav navbar-nav navbar-left">
<li class="tooltip-sidebar-toggle">
<a href="" id="menu-toggle">
<i class="fa fa-th-list" aria-hidden="true"></i>
</a>
</li>
</ul>
<!-- <ul id='menu-usuario' class="nav navbar-nav navbar-right nav-dropdown">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" data-method="reload">
<i class="fa fa-user" aria-hidden="true"></i> <span class="caret"></span>
</a>
{{usermenu}}
</li>
</ul> -->
</header>
@@ -1,15 +0,0 @@
<!-- Sidebar -->
<nav id="sidebar-wrapper">
<div class="logo" style="">
<img src='/media/logo.png' alt="logo" />
</div>
<!-- <div class="search-nav" style="">
<input class="form-control" type="text" placeholder="Busca"/>
</div> -->
<hr />
{{elements}}
<ul id="side-second-menu" class="hidden nav">
</ul>
</nav>
<!-- /#sidebar-wrapper -->
+5 -3
View File
@@ -8,9 +8,11 @@ RouteCollection::add('GET','/', function(){
global $OUTPUT; global $OUTPUT;
$OUTPUT->setTemplate(); $OUTPUT->setTemplate();
$OUTPUT->renderView('wellcome', Array('string' => Array('welcome' => 'Bem vindo'))); //$OUTPUT->renderView('wellcome', Array('string' => Array('welcome' => 'Bem vindo')));
$OUTPUT->setView('wellcome');
//$OUTPUT->renderView('wellcome', Array('string' => Lang::getStrings('welcome'))); $OUTPUT->addValue('string', Array('welcome' => 'Bem vindo'));
$OUTPUT->addValue('palavrinha', 'Oi');
$OUTPUT->render();
}); });
RouteCollection::add('get', '/welcome', 'WellcomeController@welcome'); RouteCollection::add('get', '/welcome', 'WellcomeController@welcome');
@@ -3,4 +3,4 @@
</div> </div>
{{string.welcome}} to hell... {{string.welcome}} to hell...
<br /> <br />
I shal be your guide I shal be your guide {{palavrinha}}