如何在freemarker中使用另一个.ftl的变量

发布于 2025-01-27 19:51:22 字数 381 浏览 4 评论 0原文

我正在尝试在第二个模板中使用定义的变量,以在当前输出中具有相同的输出。

模板1:

      [#if definition.name=="configMINIMAL_STACK_SIZE"]
      [#assign valueMinimalStackSize = definition.value]
      [/#if]

第二模板:

#define configMINIMAL_STACK_SIZE      ((uint16_t)${valueMinimalStackSize})

请在第二个模板中获得与“ valueminimalstacksize”相同的输出?

感谢您的帮助

I'm trying to use a defined variable in a second template to have the same output in the current one.

template 1:

      [#if definition.name=="configMINIMAL_STACK_SIZE"]
      [#assign valueMinimalStackSize = definition.value]
      [/#if]

Second template:

#define configMINIMAL_STACK_SIZE      ((uint16_t)${valueMinimalStackSize})

how could I have the same output of "valueMinimalStackSize " in the second template please ?

Thanks for the help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

糖果控 2025-02-03 19:51:22

您可以拥有一个设置这些变量的模板,我们将其称为“ Commons.ftl”,然后在开始时使用< #include“ commons.ftl”>其他模板。

You could have a template that sets these variables, let's call it "commons.ftl", and then use <#include "commons.ftl"> at the beginning of other templates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文