我在幾個月前使用過它們。然後我切換到燃料。然後我轉回Kohana。Kohana中的模板3.1
問題?我忘了如何正確使用模板(我的意思是Controller_Template
)。 Kohana的文檔有tutorials,但現在鏈接似乎被打破。
請提醒我如何使用它們!
我在幾個月前使用過它們。然後我切換到燃料。然後我轉回Kohana。Kohana中的模板3.1
問題?我忘了如何正確使用模板(我的意思是Controller_Template
)。 Kohana的文檔有tutorials,但現在鏈接似乎被打破。
請提醒我如何使用它們!
如果你真的想使用它們,你必須擴展Kohana_Template
。然後,你將公共領域「$模板」設置爲您的視圖名稱,然後就去做$這個 - >模板 - >富=「foo」的設置在模板上
public class Controller_MyController extends Controller_Template
{
public $template = "my_view";
public function action_foo()
{
$this->template->foo = "foo"
}
}
但核心開發人員勸阻變量人們使用它。您最好使用Kostache等模板引擎來組成模板。
$template = 'mytemplate';
function action_index() {
$template->content = new View("content");
$template->content->title = "page title"; // depends on the fields in your view
}
這將要求mytemplate.php和content.php查看文件存在
過了一段時間,但您的文章中有一件事對我來說很有趣。你爲什麼從Fuel轉換到Kohana? – 2011-08-02 10:11:29
另一個有趣的問題是爲什麼要嘗試燃料? – SET 2012-07-07 18:33:53
那麼,我想嘗試所有可能的工具...我想知道它們!例如,我現在正在使用Python。 :) – daGrevis 2012-07-09 17:54:37