定制 ride/web-template-smarty 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

ride/web-template-smarty

Composer 安装命令:

composer require ride/web-template-smarty

包简介

Smarty template integration for the base web application of the Ride framework

README 文档

README

This module adds template blocks, functions and modifiers for a Ride application to Smarty.

Block functions

[Smarty docs]

isGranted

Parse block content if the specified route/url/permission is allowed.

Parameter Type Description
route String Path to check for allowance.
url String URL to check for allowance.
permission String Permission code to check for allowance.
strategy String AND or OR when checking more then one of the above checks.
var String Variable to assign the result to. (true if this block content will be printed, false otherwise)
{isGranted permission="cms.node.varnish.manage"}
  ...
{/isGranted}

Note: The content of this block is always rendered. If the content is used for logic, assign the grant to a var and use an if statement.

isNotGranted

Parse block content if the specified route/url/permission is not allowed.

Parameter Type Description
route String Path to check for allowance.
url String URL to check for allowance.
permission String Permission code to check for allowance.
strategy String AND or OR when checking more then one of the above checks.
var String Variable to assign the result to. (true if this block content will be printed, false otherwise)
{isNotGranted permission="cms.node.varnish.manage"}
  ...
{/isNotGranted}

Note: The content of this block is always rendered. If the content is used for logic, assign the grant to a var and use an if statement.

Template functions

[Smarty docs]

apiMethodParameters

{apiMethodParameters method= url= namespace= classes=}

apiType

{apiType type= url= method= html= link= namespace= classes=}

image

Return the URL of a transformed image.

Parameter Type Description
src String Source url or file for this image.
default String Fallback for src parameter.
transformation String Name of the transformation.
var String Variable name to assign this URL to.
thumbnail --- Deprecated

⚠️ Transformations may require additional parameters.

For more information about the transformations and their parameters, check out ride-lib-image.

{image src=$content->image var='image' transformation='crop'}

parsley

Adds parsley data attributes to the attributes of a form widget.

Parameter Type Description
type string Type of the form row widget
validators Array Validators of a form row
var String Variable name to assign the updated attributes to.
{$widget = $formRow->getWidget()}
{parsleyAttributes attributes=$widget->getAttributes() type=$widget->getType() var="attributes"}

tableVars

Add these FormTable variables to the template:

  • $tableNameField
  • $tableActionField
  • $tableIdField
  • $tableOrderField
  • $tableSearchQueryField
  • $tablePageRowsField
{tableVars}

translate

Translate a key using the i18n translator.

Parameter Type Description
key String Translation key.
locale String Translation locale.
n Integer Number of items for a translation that describes multiple items.
var String Variable name to assign the translated key to.
{translate key='label.submit' locale='nl'}

⚠️ When simply translating a key, using the {$key|translate} modifier syntax is preferred.

url

Create an URL.

Parameter Type Description
id String Route ID.
parameters Array Path arguments for the URL.
query Array Query parameters.
separator String Seperator for query parameters. (defaults to &)
var String Variable name to assign the URL to.
object Boolean Return URL Object instead of String. (defaults to false)
{url id='api.search' var='searchUrl'}

Modifiers

[Smarty docs]

decorate

Parameter Type Description
String ID of the decorator.

Common decorator IDs: storage.size / time / date.format / file / file.extension / file.size

{$content->data->getDatePublished()|decorate:'time'}

safe

Modify a string value to safely use it as a file name, URL, id etc.

{'Unsafe string!'|safe} {* result: unsafe-string *}

translate

Parameter Type Description
Array Variables to be replaced in the translation.
{'label.fields.required'|translate}

Related Modules

Installation

You can use Composer to install this application.

composer require ride/web-template-smarty

ride/web-template-smarty 适用场景与选型建议

ride/web-template-smarty 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.36k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ride/web-template-smarty 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ride/web-template-smarty 我们能提供哪些服务?
定制开发 / 二次开发

基于 ride/web-template-smarty 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 5.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 18
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-02-21