Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for Passing Information from Template to Host App Using Scoped Variables #674

Open
juhani-honkala opened this issue Jun 19, 2024 · 5 comments

Comments

@juhani-honkala
Copy link

How would you propose passing information from a template to the host application? We are considering using constructs similar to {% assign foobar 10 %}. However, currently, this sets the variable only in a local scope, which fails when there is a variable with the same name in the global scope. We would like the ability to reset the global scope variable directly from the template. Can this functionality be implemented, or is there a recommended approach to handle such scenarios?

@hishamco
Copy link
Collaborator

This might be helpful https://deanebarker.net/tech/fluid/context/

@juhani-honkala
Copy link
Author

Thanks for link. However, it does not help or give guidance how to assign variables from the template so that they can be read back by the host application.

@sebastienros
Copy link
Owner

You will need to create your own tag for that. You might be able to override what assign does, but that could lead to unknown behavior for the common case.

@sebastienros
Copy link
Owner

Note that creating such a tag should be very easy, creating new tags is explained on the in the README.

@hishamco
Copy link
Collaborator

What if there's a variable with the same name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants