jossmp/jquery-tmpl-php
Composer 安装命令:
composer require jossmp/jquery-tmpl-php
包简介
A PHP library for rendering jQuery templates server-side
README 文档
README
A PHP library for rendering jQuery templates server-side. Inspired by jQuery-tmpl.Net and of course jQuery Templates.
Usage
jQuery-tmpl-PHP was written to mimic to a certain extent the jQuery Templates method calls. An example file has been included showing various usage cases.
The jQueryTmpl() object supports the following method calls:
getHtml()- Parameters: None
- Purpose: Returns the generated HTML in the buffer and clears it.
renderHtml()- Parameters: None
- Purpose: Prints the generated HTML in the buffer and clears it.
template(name, jQueryTmpl_Markup)- Parameters:
- String name for the template.
- The markup to be compiled.
- Purpose: Compiles the given template markup.
- Parameters:
tmpl(name/jQueryTmpl_Markup, jQueryTmpl_Data)- Parameters:
- String name of a precompiled template or the markup to be compiled.
- The data to be applied to the template.
- Purpose: Renders the template with the given data and stores it in the output buffer.
- Parameters:
Supported Tags
${property}and{{= property}}Both the shorthand
${}and{{= }}are supported. Will print out the value of the indicated property on the provided data object. Nested property resolution is supported. However expression/function evaluation is not currently supported. (See roadmap.){{html property}}Renders the value of the property without HTML encoding. Otherwise identical to
${}.{{each(index, value) property}}...{{/each}}Renders an instance of the tag contents for each item in the property value on the provided data object. Custom index and value variables can be optionally passed in.
{{if property}}...{{/if}Renders the content of the tag if the property value on the provided data object evaluates to
true. This is javascript-style evaluation so 0, null, empty string are allfalse.{{else property}}Used within the
{{if}}tag to evaluate else conditions. The property value is optional.{{tmpl(data, options) template}}This tag takes data and options as optional parameters. The tag will render a existing rendered template (using the
template()method) in place. When a data property is passed in only the portion of data referenced by that property is passed to the template specified. Options is currently not supported.{{! comments}}This tag does not appear to be documented on the official jQuery site however it does exist in code. The same functionality is preserved here, comments are simply discarded in rendered output.
Roadmap
The following is on my todo list.
- Support for JavaScript expresion evaluation.
- Support for
{{wrap}}
jossmp/jquery-tmpl-php 适用场景与选型建议
jossmp/jquery-tmpl-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jossmp/jquery-tmpl-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jossmp/jquery-tmpl-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-10-25