admin管理员组文章数量:1276752
I want to have achieve something similar to Java Tiles framework using only client side technologies (no server side includes).
I would like to have one page, eg layout.html which will contain layout definition. Content placeholder in that page would be empty #content div tag.
I would like to have different content injected on that page based on url. Something like layout.html?content=main or layout.html?content=edit will display page with content replaced with main.html or edit.html.
The goal is to avoid duplicating code, even for layout, and to pose pages without server-side templating.
What approach would you suggest?
EDIT: I don't need a full templating library, just a way to pose a pages, similar for what tiles do.
I want to have achieve something similar to Java Tiles framework using only client side technologies (no server side includes).
I would like to have one page, eg layout.html which will contain layout definition. Content placeholder in that page would be empty #content div tag.
I would like to have different content injected on that page based on url. Something like layout.html?content=main or layout.html?content=edit will display page with content replaced with main.html or edit.html.
The goal is to avoid duplicating code, even for layout, and to pose pages without server-side templating.
What approach would you suggest?
EDIT: I don't need a full templating library, just a way to pose a pages, similar for what tiles do.
Share Improve this question edited Nov 1, 2010 at 21:58 Marko asked Nov 1, 2010 at 21:48 MarkoMarko 31.5k18 gold badges78 silver badges108 bronze badges4 Answers
Reset to default 4JavaScriptMVC has a view templating system that supports different engines, including a pure JavaScript based one called EJS.
You might also want to look into Mustache especially Mustache for JavaScript.
If you would like to use jQuery, there is a decent templating engine in development as well:
http://github./jquery/jquery-tmpl
http://api.jquery./jquery.tmpl/
Check this out:
http://layout.jquery-dev/
I thinks it's close to what you want.
I am looking at javascriptMVC at the same time.
In the forum they are talking about using jquery layout with it.
I don't know if it fit exactly to what you want to do, but using the GWT seems to be a good approach for rich client-side applications :
You write all your application in Java with the framework, and you pile for obtain HTML and JS files working stand-alone.
本文标签: Pure HTMLJavaScript client side templatingStack Overflow
版权声明:本文标题:Pure HTML + JavaScript client side templating - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741276756a2369773.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论