pridemon / kohana-blade
为Kohana框架集成的Laravel Blade模板引擎
dev-master
2015-09-03 09:52 UTC
Requires
- philo/laravel-blade: 3.*
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());