定制 humming/template 二次开发

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

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

humming/template

Composer 安装命令:

composer require humming/template

包简介

Fast Widget Template Without If Else

README 文档

README

This library provides a fast implementation of simple widgets.

Install

To install with composer:

composer require humming/template

Requires PHP 5.3 or newer.

Usage

Here's a basic usage example:

<?php

require '/path/to/vendor/autoload.php';

$templateDir = __DIR__ . '/template';
$compiledDir = __DIR__ . '/compiled';
$cache = new Psr\SimpleCache\CacheInterface();
$container = new Psr\Container\ContainerInterface();
$template = new \Humming\Template($templateDir, $compiledDir, new \Humming\Thigh($cache, $container), new \Humming\Pagination());

$template->assign('something', $somthing);
$template->display("test");
test.html
<html>
<body>
<h1>{$global.something}</h1>
</body>
</html>

Widgets

class HighSchoolStudent extends \Humming\Widget
{
    public function getItems($limit = 10, $name = '')
    {
        return array('title' => 'Students', 'rows=> array(
            array('id' => 1, 'name'=>'Li'),
            array('id' => 2, 'name'=>'Ming'),
            array('id' => 3, 'name'=>$name),
        );
    }
}
In Template
<html>
<body>
<h1>{var from=$widget.high_school_student.items.title name='Coco' limit=2 cache=3600}</h1>
<ul>
{section loop=$widget.high_school_student.items.rows limit=2 name='Coco'}
<li>{$rows.name}</li>
{/section}
</ul>
<h3>First Boy is {$widget.high_school_student.items.rows.0.name}</h3>
</body>
</html>

Include

<div class="main">{include file='main.html'}</div>

Paging

<div class="pagination">
{paging link="/test/?page=@number@" page=$global.page size=20 total=$global.total}
</div>

OR

<?php
$template->getPagination()->setUrl("/test/?page=@number@");
$template->getPagination()->setNumber(1);
$template->getPagination()->setSize(20);
$template->getPagination()->setTotal(100);
?>
<div class="pagination">
{paging template="/frontend/paging.html"}
</div>

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固