2017 © Pedro PelĂĄez
 

library template-buffer

Template engine with php buffer

image

enzonagata/template-buffer

Template engine with php buffer

  • Thursday, May 3, 2018
  • by enzonagata
  • Repository
  • 0 Watchers
  • 1 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 21 Versions
  • 0 % Grown

The README.md

Template render with PHP buffer and Slim 3

Only use files with *.phtml extension, for the moment can not be changed., (*1)


Class Template;

Get started

$View = new Template($container);

Configuring Layout path - Root directory

$dir = 'path/subpath';
$View->setLayoutPath($dir);

Configuring Templates path - Root directory

$dir = 'path/subpath';
$View->setTemplatePath($dir);

Create variables to access in to Templates and Layouts

$var = array(); || $var = (string); || $var = (integer);
$View->set('nome_variavel', mixed $var);

How to access variables in to Template or Layout files



=$variable_name?> , (*2)

    $item){?>
  • = $key; ?> => = $item; ?>

Rendering template

//Obs.: file name without extension
$View->render('file_name');

//If it is in a subdirectory of the configured Template folder.
//Obs.: file name without extension
$View->render('path_name/file_name');

Class Html;

This class has been extended by default in the Template class, and can be accessed with the public variable $View->Html, (*3)

Adding CSS in Layout

//Don't write with extension *.css
$View->Html->addStyles(array(),$option(String('top','bottom')));
//ex:
$View->Html->addStyles(['styles','admin/index'],$option);

Displaying css in layout

<head>
=$this->Html->css('top');?>
</head>
<footer>
=$this->Html->css('bottom');?>
</footer>

Adding JS in Layout

//Don't write with extension *.js
$View->Html->addScripts(array(),$option(String('top','bottom')));
//ex:
$View->Html->addScripts(['scripts','admin/index'],$option);

Displaying JS in Layout

<head>
<?=$this->Html->js('top');?>
</head>
<footer>
<?=$this->Html->js('bottom');?>
</footer>

Displaying imagem

<body>
<?=$this->Html->image('nome_do_arquivo.extensĂŁo','classe_css');?>
</body>

Class Text;

This class has been extended by default in the Template class, and can be accessed with the public variable $View->Text, (*4)

//Text clean
$this->Text->clean($string);

//Text excerpt
$this->Text->excerpt($string,$startPos=0,$maxLenght=100);

//Slugfy - Url Friendly
$this->Text->slugfy($text)

The Versions

03/05 2018

dev-master

9999999-dev

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

03/05 2018

v0.2.9

0.2.9.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

03/05 2018

v0.2.8

0.2.8.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

02/05 2018

v0.2.7

0.2.7.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

02/05 2018

v0.2.6

0.2.6.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

02/05 2018

v0.2.5

0.2.5.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

02/05 2018

v0.2.4

0.2.4.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

24/04 2018

v0.2.3

0.2.3.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

24/04 2018

v0.2.2

0.2.2.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

19/04 2018

v0.2.1

0.2.1.0

Template engine with php buffer

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

by Enzo Nagata

19/04 2018

v0.2.0

0.2.0.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

19/04 2018

v0.1.9

0.1.9.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

19/04 2018

v0.1.8

0.1.8.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

19/04 2018

v0.1.7

0.1.7.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

19/04 2018

v0.1.6

0.1.6.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

19/04 2018

v0.1.5

0.1.5.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

18/04 2018

v0.1.4

0.1.4.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

18/04 2018

v0.1.2

0.1.2.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

18/04 2018

v0.1.3

0.1.3.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

18/04 2018

v0.1

0.1.0.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata

18/04 2018

v0.1.1

0.1.1.0

Template engine with php buffer

  Sources   Download

MIT

by Enzo Nagata