定制 moo/template-tags 二次开发

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

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

moo/template-tags

最新稳定版本:3.0.0

Composer 安装命令:

composer require moo/template-tags

包简介

Provide a several useful template tags.

README 文档

README

SilverStripe template parser

Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version License

Provide a several template tags for better template implementation. For example an improved <% include %>.

Requirements

  • SilverStripe CMS ^5.0

Installation via Composer

composer require moo/template-tags

Usage

Spaceless

Remove extra whitespaces from around the template syntax & HTML output.

<% spaceless %>
    ... Template syntax and HTML ...
<% end_spaceless %>

Template

An alternative to <% include %>

<% template TemplateName %>
    <% set Theme %>$ClassName<% end_set %>
    <% set Someone %>
        Github user: {$ClassName}-{$ID}-{$MenuTitle.XML}
    <% end_set %>

    <h1>Hello world</h1>

<% end_template %>

Ways to define template name

  • By string
<% template TemplateName %><% end_template %>

<% template 'Namespace\TemplateName' %><% end_template %>
  • By variable or method within an object
<% template $TemplateName %><% end_template %>

<% template $Object.Method %><% end_template %>

The body of the template tag

  • The body of the tag can include HTML, template logic, & defined arguments.
<% template TemplateName %>
    <h1>Hello world</h1>
<% end_template %>
  • The body of the block can include other syntax such as <% include %>
<% template TemplateName %>
    <h1>Hello world</h1>
    <% include Icon %>
<% end_template %>
  • You can pass parameters, one per line! not all in same line as '<% include %>
<% template TemplateName %>
    <% set Theme %>$Theme<% end_set %>
    <% set Someone %>
        Github user: {$Member.Name}
    <% end_set %>

    <h1>Hello world</h1>
<% end_template %>

TemplateName.ss <% content %> Placeholder for the content of the template ie. <h1>Hello world</h1>

<div class="theme--{$Theme}">
   <% content %> 
   <p>Are you a {$Someone}</p> 
</div>

License

This module is under the MIT license. View the LICENSE file for the full copyright and license information.

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固