承接 enzonagata/template-buffer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

enzonagata/template-buffer

Composer 安装命令:

composer require enzonagata/template-buffer

包简介

Template engine with php buffer

README 文档

README

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

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

<p>
   <?=$variable_name?>
</p>

<!-- With array -->
<ul>
<?php foreach($variable_name as $key => $item){?>
   <li><?= $key; ?> => <?= $item; ?></li>
<?php } ?>
</ul>

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

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

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

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

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

统计信息

  • 总下载量: 35
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固