lejahmie/slim-mustache-view 问题修复 & 功能扩展

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

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

lejahmie/slim-mustache-view

Composer 安装命令:

composer require lejahmie/slim-mustache-view

包简介

Mustache View package for the Slim Framework

README 文档

README

Mustache View package for the Slim Framework 3+, using bobthecow great PHP implementation of Mustache! ;-)

How to install

Using Composer

$ composer require lejahmie/slim-mustache-view

How to use

<?php
require 'vendor/autoload.php';

$app = new \Slim\Slim();
$container = $app->getContainer();
$container['view'] = function ($c) {
    $mustache = new \Slim\Mustache\Mustache(
        '/templates', // Template path
        array(
            'charset' => 'UTF-8',
        ),
        array(
            'extension' => '.html'
        )
    );
    return $mustache;
};
$app->get('/', function (Request $request, Response $response) {
    // The render method takes the reponse object,
    // template name and finally some data as an array.
    $response = $this->view->render($response, "hello", ["foo" => 'bar']);
    return $response;
});

Methods

render($templateName, $data)

Renders the Mustache template with the ResponseInterface used by Slim; $response->getBody()->write($output);

getRenderedMarkup($templateName, $data)

Returns the renderd Mustache template as a string.

setTemplatePath($templatePath)

Set the template path where Mustache will look for template files.

setLoaderOptions($loaderOptions)

Set the options for Mustache filesystem loader. See; https://github.com/bobthecow/mustache.php/wiki/Template-Loading

setOptions($options)

Set the Mustache options. See; https://github.com/bobthecow/mustache.php/wiki

Authors

Jamie Telin

License

The MIT License (MIT)

Change log

1.0.1

  • Added method getRenderedMarkup($templateName, $data) which allow to fetch the processed markup as raw html string.
  • Fixed some typos.
  • Better readme, because you all read this right? :-D

1.0

  • First version y'all!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固