scaleplan/templater
Composer 安装命令:
composer require scaleplan/templater
包简介
PHP-templater for Scaleplan framework
README 文档
README
Template engine for PHP.
Installation
composer reqire scaleplan/templater
Description
Templates are HTML documents, standardization is based on adding specific classes to the HTML templates: we insert classes that indicate what data and where to insert. When creating an object, we pass the path to the template file to the designer, after that, we can add certain data to the generated page, most often these are samples from the database. The data should be in the form of an array of records, where the record is an associative array. You can insert data either in the HTML element text or in some attributes.
For example:
Have a template block:
<div class= "user parent">
<span class= "in_text_name" ></span>
<img class= "in_src_image">
<a class= "in_href_link in_class_user_link_class" >Account</a>
</div>
And data:
$data = [
[
'name' = > 'Aleksandr',
'image' = > '/img/photo.jpg',
'link' = > '/users/12'
'user_link_class' = > 'trash-user'
]
];
Then running the code:
$page = new PQSkaTpl ('/templates/main.html');
echo (string) $page->setMultiData ($data, '.user');
We get the HTML:
<div class= "user">
<span class= "in_text_name" >Aleksandr</span>
<img class=" in_src_image"src="/img/photo.jpg">
<a class= "in_href_link in_class_user_link_class trash-user" href= "/users/12 " >Account</a>
</div>
If the data contains multiple records, the template block will be copied as many times, how many records contain data. Blocks will be inserted one after another.
scaleplan/templater 适用场景与选型建议
scaleplan/templater 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 161 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 11 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 scaleplan/templater 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 scaleplan/templater 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 161
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-11-04