sitegeist/fluid-tagbuilder
Composer 安装命令:
composer require sitegeist/fluid-tagbuilder
包简介
ViewHelpers for html5 tags that improve readability in complex fluid templates
README 文档
README
This is an attempt to make complex Fluid templates with a lot of dynamically pieced together HTML tags more readable.
Disclaimer: This is no one fits all solution and should only be used when appropriate, certainly not for all tags in your template!
before:
<button class="{class} {f:if(condition: isBold, then: 'bold')} {f:if(condition: isActive, then: 'active')}" data-items="{data.items}" data-count="{data.count}" {f:if(condition: title, then: 'title="{title}"')} ><f:spaceless> More content </f:spaceless></button>
after:
<ft:button class="{class}" :classList="{ 'bold': isBold, 'active': isActive }" :dataList="{data}" :spaceless="1" title="{title}" > More content </ft:button>
Getting started
Install the library via composer:
composer require sitegeist/fluid-tagbuilder
... and start using it in your templates:
<html xmlns:ft="http://typo3.org/ns/Sitegeist/FluidTagbuilder/ViewHelpers" data-namespace-typo3-fluid="true">
With TYPO3 14 you can define the global Fluid namespaces within php:
// EXT:my_extension/Configuration/Fluid/Namespaces.php <?php return [ 'ft' => ['Sitegeist\\FluidTagbuilder\\ViewHelpers'], ];
Features
- supports all tags currently defined by the HTML specification (see below)
- supports all currently defined
booleanHTML5 attributes- if
true:required="required" - if
false: no attribute
- if
- removes empty tag attributes
- generates optimized class attribute from
:classList="{...}" - generates data attributes from
:dataList="{...}" - generates additional tag attributes from
:attributeList="{...}" - short hand to remove whitespace with
:spaceless="1"
Supported HTML tags
The extension includes short-hands for the following HTML5 elements:
aabbraddressareaarticleasideaudio(withautplay,controls,loop,mutedas additional boolean attributes)bbasebdibdoblockquotebodybrbutton(withdisabled,formnovalidateas additional boolean attributes)canvascaptioncitecodecolcolgroupdatadatalistdddeldetails(withopenas additional boolean attribute)dfndialog(withopenas additional boolean attribute)divdldtemembedfieldset(withdisabledas additional boolean attribute)figcaptionfigurefooterform(withnovalidateas additional boolean attribute)h1h2h3h4h5h6headheaderhgrouphrhtmliiframe(withallowfullscreenas additional boolean attribute)img(withismapas additional boolean attribute)input(withchecked,disabled,formnovalidate,multiple,readonly,requiredas additional boolean attributes)inskbdlabellegendlilink(withdisabledas additional boolean attribute)mainmapmarkmathmenumetameternavnoscriptobjectol(withreversedas additional boolean attribute)optgroup(withdisabledas additional boolean attribute)option(withdisabled,selectedas additional boolean attributes)outputpparampicturepreprogressqrprtrubyssampscript(withasync,defer,nomoduleas additional boolean attributes)sectionselect(withdisabled,multiple,requiredas additional boolean attributes)slotsmallsourcespanstrongstylesubsummarysupsvgtabletbodytdtemplatetextarea(withdisabled,readonly,requiredas additional boolean attributes)tfootththeadtimetitletrtrack(withdefaultas additional boolean attribute)uulvarvideo(withautoplay,controls,loop,muted,playsinlineas additional boolean attributes)wbr
All listed elements support the following boolean attributes:
autofocushiddenitemscope
sitegeist/fluid-tagbuilder 适用场景与选型建议
sitegeist/fluid-tagbuilder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.75k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「template」 「HTML5」 「html」 「tag」 「fluid」 「typo3-fluid」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sitegeist/fluid-tagbuilder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sitegeist/fluid-tagbuilder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sitegeist/fluid-tagbuilder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
HTML5 support for SilverStripe
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
HTML5 Boilerplate is a professional front-end template for building fast, robust, and adaptable web apps or sites.
The yii2-videojs-widget is a Yii 2 wrapper for the [video.js](http://www.videojs.com/). A JavaScript and CSS library that makes it easier to work with and build on HTML5 video. This is also known as an HTML5 Video Player.
HTML and form generation
Simple ASCII output of array data
统计信息
- 总下载量: 10.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2021-06-14