在EJS模板引擎中,我如何“包含”一个页脚? [英] In EJS template engine, how do I "include" a footer?

查看:96
本文介绍了在EJS模板引擎中,我如何“包含”一个页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我保存了一个页脚的小脚本。我如何包含在我目前的模板?

解决方案

我知道这个问题已被标记为已回答,但我相信你在寻找的是'部分'语法。在EJS中,您可以将来自一个视图模板的内容包含在另一个视图模板中,如下所示:

 < html> 
< head>< / head>
< body>
Blah等等等等
<% - 部分('footer')%>
< / body>
< / html>


Let's say I saved a snipplet of a footer. How do I "include" that in my current template?

解决方案

I know this question has already been marked as answered, but I believe what you were looking for is the 'partial' syntax. In EJS, you can include the content from one view template in another like so:

<html>
  <head></head>
  <body>
    Blah blah blah
    <%- partial('footer') %>    
  </body>
</html>

这篇关于在EJS模板引擎中,我如何“包含”一个页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆