Skip to content

How to add parameters for templates? #1873

Answered by joachimvh
Chiyo-no-sake asked this question in Q&A
Discussion options

You must be logged in to vote

There is no immediate out-of-the-box solution for this. Your main two options seem to be to either add an additional component that is similar to the HtmlViewhandler, or a new EjsTemplateEngine.

HtmlViewHandler

Create a new class that extends the HtmlViewHandler, but have a new implementation of handle so it sends your additional parameter(s). Insert it in front of the other elements in the array here.

Specific Overrides can be used to determine the position of your new element in an existing array. See the documentation here or some info in the tutorial here.

The templates you then provide to your new class would be the ones that need those new parameters.

EjsTemplateEngine

Similar as ab…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Chiyo-no-sake
Comment options

You must be logged in to vote
1 reply
@joachimvh
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants