So I don't know if this can be done: I'd like to make a widget that sets a variable to a particular value, and lets me choose which variable every time I use it. But I can't do:
<<widget mywidget>><<set $args[0] to "something complicated">><<endwidget>>
and then
<<mywidget $specificvar>>
Because that would just pass the current value of $specificvar to the widget, which obviously wouldn't do anything. Is there some way to work around this?
Comments
(not tested, just a suggestion)
In that case, I could also just make several widgets with slightly different names, which is my current workaround...
Beyond that, you need to use the Stupid Print Trick™ to render a <<set>> with the name of the passed in variable on the left-hand side of the assignment expression.
Try something like the following:
EDIT: Actually I think I do now, the different types of quote marks confused me at first.
For example, assuming an invocation of the widget like: Yields a <<set>>, which is parsed, like the following: