定制 heyday/silverstripe-reusablehtml 二次开发

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

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

heyday/silverstripe-reusablehtml

最新稳定版本:0.2.0

Composer 安装命令:

composer require heyday/silverstripe-reusablehtml

包简介

SilverStripe Reusable Html

README 文档

README

All of Bootstrap's boilerplate element structures as composable templates, as well as some other common HTML structures. Composable templates are achieved using heyday/silverstripe-composeparser, which also provides the short include syntax used in this readme (eg. <:MyTemplate/>).

Installation (with composer)

$ composer require heyday/silverstripe-reusablehtml

Usage example

A Bootstrap modal:

<:bsmodal fade=1>
	<:bsmodalheader>
		<h2>Hello, world!</h2>
	</:bsmodalheader>

	<:bsmodalbody>
		<p>We're in a Bootstrap modal!</p>
	</:bsmodalbody>
</:bsmodal>

For a full list of templates provided by this module, look in the templates directory.

Template blocks

Reusable HTML adds two additional template blocks that are used in the templates it provides: required and dataattrs. These can also be used in your own templates.

<% required %>

The required block allows defining a list of variables that must be present for the template to render. Missing variables will cause an exception to be thrown during template rendering.

<:MyTemplate foo="Hello"/>

// MyTemplate.ss
<% required $foo, $bar %>

// Result
InvalidArgumentException: the field 'bar' is required

<% dataattrs %>

The data attributes block renders all HTML data attributes passed into an include statement. No closing block is required.

<:MyTemplate data-foo="bar"/>

// MyTemplate.ss
<div <% dataattrs %>></div>

// Rendered
<div data-foo="bar"></div>

统计信息

  • 总下载量: 468
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 26
  • Forks: 2
  • 开发语言: Scheme

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-16