Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates Kohana框架3.3中的模板_Templates_Frameworks_Kohana - Fatal编程技术网

Templates Kohana框架3.3中的模板

Templates Kohana框架3.3中的模板,templates,frameworks,kohana,Templates,Frameworks,Kohana,我使用的是Kohana框架,这实际上是我使用的第一个框架。我只是想知道如何在视图中正确添加模板。我现在正在做的是 在控制器中 <?php defined('SYSPATH') or die('No direct script access.'); class Controller_Welcome extends Controller_Template { public $template = 'site'; public function action_index()

我使用的是Kohana框架,这实际上是我使用的第一个框架。我只是想知道如何在视图中正确添加模板。我现在正在做的是

在控制器中

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Welcome extends Controller_Template {

    public $template = 'site';

    public function action_index()
    {
        $this->template->header = View::factory('templates/header');
        $this->template->header->title = 'Page name - Welcome';
        $this->template->header->description = 'Blah blah blah.';
    }
看看Kohana的插件。我想这是将布局与逻辑分离的最佳方法。

看看Kohana的插件。我知道将布局与逻辑分离的最佳方法。

看一看 它允许你做一些简单的事情,比如

<li>{{kostachevariable}}</li>
在模板文件中,您只需要

<head>
<title>{{mypagetitle}}</title> 

{{mypagetitle}}
它还有很多其他的好功能。

看看 它允许你做一些简单的事情,比如

<li>{{kostachevariable}}</li>
在模板文件中,您只需要

<head>
<title>{{mypagetitle}}</title> 

{{mypagetitle}}
它还有很多其他的好功能