定制 antonienko/php-template-previewer 二次开发

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

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

antonienko/php-template-previewer

最新稳定版本:v0.2.0

Composer 安装命令:

composer require antonienko/php-template-previewer

包简介

For designers testing their framework views without the working backend code.

README 文档

README

Build Status

PHP template previewer for designers testing their framework views without the working backend code.

Originally created for a personal project using the Phalcon PHP framework and its templating system Volt.

####Disclaimer: This is my first composer as well as open source project, so if you see anything that needs improving, don't hesitate and tell me. Read my introduction post

##List of implemented frameworks

  • Phalcon

###Extending the framework support You can make a request for any framework that you want to use this library into, or even better, make a pull request with your own framework strategy. Just implement the IFrameworkStrategy interface. Use the files under the FrameworkStrategies folder as an example.

##What's new

v0.2.0

  • Added Json file support for the variable files

##Installation ###Composer This library is available in packagist.org, you can add it to your project via Composer.

In the "require" section of your composer.json file:

Always up to date (bleeding edge, API not guaranteed stable)

"antonienko/php-template-previewer": "dev-master"

Specific minor version, API stability

"antonienko/php-template-previewer": "0.2.*"

If you have any problems with the minimum-stability setting try appending @dev to the version

"antonienko/php-template-previewer": "0.2.*@dev"

##Sample Usage

Phalcon Framework

DesignController with an action View that gets two parameters: $controller and $view, which are the name of the controller and action view that you want to render. You would call the url like this: http://localhost/designTest/view/controllername/viewname but you are not restricted to use it in this way

namespace app\controllers;
use antonienko\PhpTempPrev\FrameworkStrategies\PhalconStrategy;
use antonienko\PhpTempPrev\FileStrategies\IniFileStrategy;
use antonienko\PhpTempPrev\Previewer;

class DesignTestController extends ControllerBase
{
    public function viewAction($controller, $view)
    {
        $view_variables_file = APP_PATH . 'templateHelpers/' . $controller . '/' . $view . '.ini';
        $layout_variables_file = APP_PATH . 'templateHelpers/general.ini';
        $previewer = new Previewer(new PhalconStrategy($this->view));
        $previewer->render("$controller/$view", new IniFileStrategy([$layout_variables_file, $view_variables_file]));
    }
}

Var files

You pass to the render a class implementing IFileStrategy initialized with an array of var files. In case of having the same variable defined in two of the var files, the last one will prevail.

The variables are separated in three categories: scalars, arrays and objects.

If you want to get an idea of how the var files work take a look at the test fixtures.

##License Information Lincensed under The MIT License (MIT). See the LICENSE file for more details.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固