plato-creative/silverstripe-htmltag
最新稳定版本:1.1.3
Composer 安装命令:
composer require plato-creative/silverstripe-htmltag
包简介
Provides a simply method for wrapping strings with html tags.
README 文档
README
Installation
Composer is the recommended way of installing SilverStripe modules.
composer require gorriecoe/silverstripe-htmltag
Requirements
- silverstripe/framework ^4.0
Maintainers
Template usage
{$h1($Title).setClass('title').setPrefix($Class)}
Is the equivalent of
<% if Title %>
<h1 class="{$class}__title title">
{$Title}
</h1>
<% end_if %>
And returns
<h1 class="title content-section__title"> This sections title </h1>
Controller/Object usage
use gorriecoe\HTMLTag\View\HTMLTag; class MyController extends Controller { public function Title() { $title = HTMLTag::create($this->Data()->Title, 'h1') ->setPrefix($this->Class); if (true) { $title->setClass('title') } return $title; } }
Accessing and modifying the output in the template
<div>
{$Title.addClass('anotherclass')}
</div>
统计信息
- 总下载量: 151
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2023-04-04