shusaura85/mythtpl 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

shusaura85/mythtpl

Composer 安装命令:

composer require shusaura85/mythtpl

包简介

Easy to use template system for PHP

README 文档

README

By Shu Saura
Based on RainTPL 3 by Federico Ulfo

MythTPL is an easy template engine for PHP that allows easy separation of the presentation from the logic.

Features

  • Simple syntax
  • Easy to use
  • Fast, templates are compiled to plain PHP code
  • Powerful, modifiers and operations with variables
  • Extensible, you can register new tags

Supported tags

  • {$variable} to include a variable in the template
  • {#CONSTANT} or {#'string'} to include a constant or string
  • {do $variable} to do an assignment. ex: {do $x = 2} / {do $x += 5} / etc. Any operations that don't require echo-ing the value.
  • {if} for conditional blocks
  • {loop} to loop over arrays
  • {include} to include another template
  • {ignore} to add private comments in the template
  • {noparse} to not process tags contained inside
  • {function} to run a PHP function
  • {php} if you really must use PHP inside your templates (disabled by default in configuration)
  • {autoescape} to automatically escape all tag values inside
  • {elseif} {else} {break} {continue} to use with conditional or looping tags
  • {t} to include a component. Similar to {include} but it can be configured with attributes ({t="component" attr="value" attr2="value2" ...}). Attributes are available in the included component inside $tdata variable as array. Component templates are stored separate from standard template files.

Installation / Usage

  • Using Composer

    composer require shusaura85/mythtpl
  • Manually

    require '/path/to/src/autoload.php'

Requirements

MythTPL requires at least PHP 7.4 to work. MythTPL has no external dependencies.

Differences compared to Rain TPL 3

  • Dropped plugin support
  • Dropped function blacklist
  • assign() now accepts only arrays (use assign_var() to set a single value)
  • Configuration is no longer static, you can now configure with constructor or dedicated configuration functions
  • Added reset() function to clear assigned values
  • Added p_assign() function to assign values that are not cleared with reset()

Licence

MythTPL is published under the MIT Licence, see LICENSE file for details.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固