node.js ejs include功能在我的情况下不起作用
我想将header.ejs和footer.ejs包括在order.ejs中。 我的文件夹结构下方的图像。
但是,我有错误。与inder.ejs相关的代码在下面编写。
/// order.ejs
<%- include('../common/header.ejs') %>
我认为我的代码错了。但是我找不到任何解决方案。
提前致谢。
添加错误消息
Error: ejs:18
16| <tr>
17| <td align="center" valign="top">
>> 18| <%- include('../common/header.ejs') %>
19| </td>
20| </tr>
21| <tr>
Could not find the include file "../common/header.ejs" {"timestamp":"2022-05-14 13:58:57"}
I want to include header.ejs and footer.ejs into order.ejs.
The image below my folder structure.
But, I've got error. The code related to include in order.ejs is written below.
/// order.ejs
<%- include('../common/header.ejs') %>
I think my code is wrong. But I could not find any solution.
Thanks in advance.
Add Error Message
Error: ejs:18
16| <tr>
17| <td align="center" valign="top">
>> 18| <%- include('../common/header.ejs') %>
19| </td>
20| </tr>
21| <tr>
Could not find the include file "../common/header.ejs" {"timestamp":"2022-05-14 13:58:57"}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题。
问题不是模板,而是EJS功能。
旧功能:
新功能:
I have solved this issue.
The problem was not a template, but the EJS function.
OLD Function:
NEW Function: