定制 nowise/uup-html 二次开发

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

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

nowise/uup-html

Composer 安装命令:

composer require nowise/uup-html

包简介

Object oriented HTML class library.

README 文档

README

An object oriented PHP library for generating HTML. It consists of component, container and utility classes making it possible to e.g. compose a form or table without having to bother with HTM tags.

Usage

The usage pattern is to create an container object (like a form) and add child containers and components to it. Once composed, just call output() to make it generate the HTML code.

The add methods create and return a object. This makes it easy to incremental adding child objects and setting properties on them. Heres an simple example on this concept for a form:

$options = array('opt1' => 'val1', 'opt2' => 'val2');

$form = new Form('script.php');

$combo = $form->addComboBox('opt');                     // Got ComboBox object in return
foreach ($options as $name => $value) {
        $option = $combo->addOption($value, $name);     // Get Option object in return
}

$form->addSubmitButton();
$form->output();                                        // Output this form

All objects can be added to another container. The output is started when calling output() on the top container. We could do like this:

$paragraph = new Paragraph();
$paragraph->addElement($form);         // Add form to paragraph
$paragraph->output();                  // Calls output on form object implicit

Javascript events can be attached to all objects by appending a code fragment for wanted event:

$textbox = new TextBox('username');
$textbox->setEvent(Event::ON_BLUR, 'if(this.value === "") { '
    . 'alert("Username can\'t be empty"); '
    . 'this.focus(); '
    . '}');

A couple of prepared event handler is defined in the Event class:

$textbox = new TextBox('username');
$textbox->setEvent(Event::ON_DOUBLE_CLICK, EVENT_HANDLER_CLEAR_CONTENT);

More

Visit the project page for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固