简体   繁体   English

Kohana-将Kostache与车把配合使用

[英]Kohana - using kostache with handlebars

I am using kostache module in KO 3.2 - view classes, templates, everything is based on php. 我在KO 3.2中使用kostache模块-查看类,模板,所有内容均基于php。 Is this ok, or even recommended, to install handlebars.js? 是否可以安装甚至建议安装handlebars.js? Will this work properly with kostache? 可以用kostache正常工作吗?

I would do this straight away if it wouldnt be written in javascript though - I'm not sure how will this work, what about people who view my website without js turned on? 如果不使用javascript编写,我会立即执行-我不确定这将如何工作,在没有打开js的情况下查看我的网站的人呢?

If you're looking for a JS templating solution then http://handlebarsjs.com/ is a fine solution. 如果您正在寻找JS模板解决方案,那么http://handlebarsjs.com/是一个很好的解决方案。 There's no reason why this should not work with kostache . 没有理由为什么这不适用于kostache

I'm not sure I understand your second paragraph there. 我不确定我在那里理解你的第二段。 It's a JS templating solution, so it's written in JS. 这是一个JS模板解决方案,因此是用JS编写的。 If the user has JS disabled in their browser then the templates will not work, but then neither would the JS that's generating them in the first place. 如果用户在其浏览器中禁用了JS,则模板将无法工作,但首先生成模板的JS也将无法工作。

Edited: It sounds to me like you may be slightly confused here too. 编辑:在我看来,您在这里也可能有些困惑。 Kostache is a server side templating engine that saves you embedding PHP logic in your views. Kostache是​​服务器端的模板引擎,可避免将PHP逻辑嵌入视图中。 handlerbars.js is a client-side templating engine, saving you from doing DOM manipulation to update content. handlerbars.js是一个客户端模板引擎,使您无需进行DOM操作即可更新内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM