如何声明要在几个 ajax 视图中使用的 freemarker 宏/函数?
我目前有一个<#macro format_phone 电话>在我的代码中,一些不同的页面使用它。我怎样才能使这个功能对多个页面可用? IE。全球。目前它是复制粘贴的,打破了 DRY 原则。
I currently have a <#macro format_phone phone> within my code, and a few different pages use it. How could I make this function be available to many pages? ie. globally. Currently it's copied and pasted, breaking the DRY principle.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将其放入
macros.ftl
文件中,<#import "macros.ftl" as m>
,然后<@m.format_phone phone> ;
You can put it in a
macros.ftl
file,<#import "macros.ftl" as m>
, and then<@m.format_phone phone>