定制 tourze/twig-html-helpers 二次开发

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

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

tourze/twig-html-helpers

最新稳定版本:1.0.0

Composer 安装命令:

composer require tourze/twig-html-helpers

包简介

Rails style view helpers for HTML tags in PHP Twig

README 文档

README

This PHP Twig extension adds the following Rails style HTML helpers:

  • check_box_tag($name, $value = '1', $default = false, $options = array())
  • content_tag($name, $content='', $options=array())
  • hidden_field_tag($name, $default = null, $options = array())
  • html_tag($name, $options=array())
  • image_tag($src, $options=array())
  • input_tag($type, $name, $value=null, $options=array())
  • label_tag($name, $text = null, $options = array())
  • labelled_text_field_tag($name, $default = null, $options = array())
  • link_tag($title, $url=null, $options=array())
  • password_field_tag($name = 'password', $default = null, $options = array())
  • radio_button_tag($name, $value, $default = false, $options = array())
  • reset_tag($value = 'Reset', $options = array())
  • select_tag($name, $options, $default = null, $html_options = array())
  • submit_tag($value = 'Submit', $options = array())
  • text_area_tag($name, $default = null, $options = array())
  • text_field_tag($name, $default = null, $options = array())

To use them, first add the extension to your composer.json:

"require": {
    "njh/twig-html-helpers": "dev-master"
},

Then load it into your environment:

$twig = new Twig_Environment();
$twig->addExtension(new Twig_Extension_HTMLHelpers());

You can then use them in your Twig templates:

{{ link_tag('http://www.example.com/') }}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-04