tina4stack/tina4php-shape 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tina4stack/tina4php-shape

Composer 安装命令:

composer require tina4stack/tina4php-shape

包简介

Tina4 PHP HTML Shape Language

README 文档

README

HTML Language called Shape where you write code to make HTML

Installation

composer require tina4stack/tina4php-shape

Basic usage

Each HTML tag has an underscore prefix, <p> tag would be _p()

Normal Tag

echo _p("Hello"); //<p>Hello</p>

Tag with Attributes

echo _div(["class" => "form-group"], "Testing"); //<div class="form-group">Testing</div>

Nesting of tags

Some things become easier to code due to nesting, think of un ordered lists or select tags.

$lis = [];

$lis[] = _li("One");
$lis[] = _li("Two");

$ul = _ul ($lis);

$options = [];

$options[] = _option("One");
$options[] = _option("Two");

$select = _select (["name" => "choose"], $options);

Finding a tag by id

Sometimes you want to manipulate a tag's content, so we find it based on the id attribute.

$tag = $html->byId("someId");

Set the html of a tag

$tag->html(_p("Changed HTML"));

Example

<?php
require_once "vendor/autoload.php";

//Start some HTML

$lis = [];

$lis[] = _li("One");
$lis[] = _li("Two");

$ul = _ul ($lis);

$html = _shape(
    _doctype("html"),
    _html(["lang" => "en"],
    _head(
        _title("Testing")
    ),
    _body(
        _h1(["id" => "someId"],"Hello World! H1"),
        _h2("Hello World! H2"),
        $a = _h3("Hello World! H3"),
        _h4("Hello World! H4"),
        _h5("Hello World! H5"),
        $ul
    )
));

$a->html(_b(["style" => "color: red"],"Hello"));

$html->byId("someId")->html("=====");

echo $html;

You should see something like this

Our Sponsors

Sponsored with 🩵 by Code Infinity

Code Infinity

Supporting open source communities Innovate Code Empower

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固