Reference Variables in Code Snippets

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
michaelatw
Jr. Propeller Head
Posts: 2
Joined: Thu Jun 20, 2024 3:27 am

Reference Variables in Code Snippets

Post by michaelatw »

Hi everyone,

I am fairly new to Flare and I am currently working on some codeSnippets in our documentation. I was wondering, if (and how) I can use variables in a codeSnippet? I have about 20 code examples providing a path that uses a version number which is changing every few releases. The version number is a variable and i want to use this in the code snippets, so that i don't have to upgrade the content manually every other releases.

Can anyone help me?
Thanks in advance
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Reference Variables in Code Snippets

Post by NorthEast »

You can insert variables in the code snippet editor in this format:
[%=VariableFileName.VariableName%]

Note that you will not see variable text displayed in the XML editor, and it'll just show the code above. But that code will be replaced by the variable text when you preview or build the output.
michaelatw
Jr. Propeller Head
Posts: 2
Joined: Thu Jun 20, 2024 3:27 am

Re: Reference Variables in Code Snippets

Post by michaelatw »

Thank you so much! I tried that before and thought it didn't work, because it didn't preview the variable in the editor. I tried it now and it works perfectly. Thanks :)
Post Reply