开发者

Kostache CSS and JS on page

How do I go about loading css and javascript in my template? I am using kostache and the template loads fine. I am trying not to load template files directly onto the templates themselves but rather do it via the VIEW.

Is this feasible? From this link

   <head>
<meta charset="utf-8" />
{{>css}}{{>js}}
<title>{{title}}</title>
</head>

Doesn't say much about those. Are they partial views? If so, does that mean that I create partial views with normal HTML tags linking to css files?

I have this within my view

public function __construct() {
    parent::__construct();
    $this->set(array(
        'reset_css_link' => 开发者_高级运维URL::site('assets/css/reset.css'),
        'style_css_link' => URL::site('assets/css/style.css'),
    ));

How do I pass that to the template.mustache file and loop through it and display what I need to display. That is the part I can't figure out.

Sample that seems to work:


I haven't used Kostache myself (yet!) but studied it briefly a few days ago. As far as I understand it, such things should probably go into your View_Layout class, have a look at how the default View_Layout class does things in Kostache and extend that class in your project.

https://github.com/zombor/KOstache/blob/master/classes/view/kohana/layout.php

This discussion is probably of good help as well: http://forum.kohanaframework.org/discussion/5722/mustache-kohana-module-for-v3-logic-less-views/p3

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜