pridemon/kohana-blade

为Kohana框架集成的Laravel Blade模板引擎

安装: 201

依赖项: 0

建议者: 0

安全性: 0

星标: 3

关注者: 3

分支: 3

开放问题: 0

类型:kohana-module

dev-master 2015-09-03 09:52 UTC

This package is not auto-updated.

Last update: 2024-09-28 17:38:34 UTC


README

基于Laravel Blade模板引擎Kohana 3.*框架,基于Philo Laravel-Blade独立组件

#安装

通过以下方式添加到您的项目中:

composer require pridemon/kohana-blade

然后运行composer install

将Kohana blade集成到您的kohana bootstrap.php文件中

Kohana::modules(array(
  
     'blade'        => MODPATH.'kohana-blade',

	));

用法

例如,将Hello.blade.php放置在application\views目录中

@extends('layouts.master')

@section('title', 'Page Title')

@section('sidebar')
    @parent

    <p>This is appended to the master sidebar. {{ $value2 }}</p>
@endsection

@section('content')
    <p>This is my body content. {{ $value }}</p>
@endsection

现在,您可以在控制器操作中编写类似以下的内容:

$value2 = 'foo';

$view = BladeView::factory('Hello');

$view->bind('value', $value);
$view->set('value2', $value2);
$value = 'bar';

$this->response->body($view->render());