Variable usage: Confused! #92
-
Hi, just trying this out today and am confused how to use variables. Here is my prompt: [choose][file prompt1]|[file prompt2][/choose] prompt1 is a txt file: prompt2 is a txt file: No matter what, "col" is always yellow. prompt1 and 2 will show up fine, but the variable seems set once, and then it is stuck. Am I doing it all wrong?!?! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's because inner shortcodes are processed before outer shortcodes, which is mentioned in the manual under "Understanding the Processing Chain". |
Beta Was this translation helpful? Give feedback.
It's because inner shortcodes are processed before outer shortcodes, which is mentioned in the manual under "Understanding the Processing Chain".
So in your case,
[choose][file prompt1]|[file prompt2][/choose]
expands to:[choose] prompt1[set "col"]blue[/set] | prompt2[set "col"]yellow[/set] [/choose]
which in turn executes both [set] in sequence before [choose].
To solve this, use {} instead of [] for file:
[choose]{file prompt1}|{file prompt2}[/choose]