简体   繁体   English

在 Velocity 模板之间传递参数

[英]Passing parameters between Velocity templates

I am trying to find out how to pass parameter while calling a velocity template from another.我试图找出如何在从另一个调用速度模板时传递参数。

it looks like this看起来像这样

File: _reading_tracker.vm文件:_reading_tracker.vm

#parse("student/shared/_bio_data.vm")

I need to pass some arguments to the _bio_data.vm.我需要将一些 arguments 传递给 _bio_data.vm。 Not sure how to do this不知道该怎么做

Instead of parsing _bio_data.vm , try creating a macro, and then calling that macro from _reading_tracker.vm .不要解析_bio_data.vm ,而是尝试创建一个宏,然后_reading_tracker.vm调用该宏。

Or, if you don't want to use a macro, then you should be able to #set($var="value") any number of variables in the outer template, and refer to those variables in the inner (parsed) template.或者,如果您不想使用宏,那么您应该能够在外部模板中#set($var="value")任意数量的变量,并在内部(已解析)模板中引用这些变量.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM