Using variables in paths

This forum is for all Flare issues not related to any of the other categories.
Post Reply
TroyWells
Propeller Head
Posts: 58
Joined: Sat Feb 04, 2006 5:27 am

Using variables in paths

Post by TroyWells »

Years ago I remember hearing someone say you could use variables in pathnames, e.g.

c:\FlareProject\[variable]\logofile.png

This way you could keep everything in the topic the same but change an image or something else based on a different folder name as defined in the variable. I need to use some method like this because topic content is mostly the same, but images within those common topics differ from client to client.

You can successfully use variables for hyperlink destinations using the syntax:

<a href="[%=VariableSet.VariableName%]">Text</a>

However, that same syntax does not seem to work for image paths, such as:

<img src="../../../Resources/Images/[%=Agencies.Folder%]/Folder1/Folder2/image.png" />

This results in nothing appearing in the output where the image is supposed to be. The build log shows a missing linked source file with a path:

C:\FlareProject\Content\Resources\Images\\Folder1\Folder2\image.png" /> (where the variable is, nothing appears in the output, thus the "\\"

Any thoughts on how to do this? Thanks!!
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: Using variables in paths

Post by NorthEast »

It seems to work ok for me - I have this image link, where the variable is set as Images.

Code: Select all

<img src="Resources/[%=Folder.ImagesFolder%]/image.png" />
The image displays ok in outputs (HTML5 and PDF) and in previews.
It doesn't get reported as build error, or as a broken link in the Analysis reports.

However, it does show a "Missing file" (grey box) for the image in the XML editor.
TroyWells
Propeller Head
Posts: 58
Joined: Sat Feb 04, 2006 5:27 am

Re: Using variables in paths

Post by TroyWells »

Thanks for confirming!! After doing additional testing, I realized that it works for me also in PDF and HTML5. However, I need it to work in Word output, and my testing indicates that it does not. Were you able to successfully test in Word output?
NorthEast
Master Propellus Maximus
Posts: 6365
Joined: Mon Mar 05, 2007 8:33 am

Re: Using variables in paths

Post by NorthEast »

No, I didn't try Word output, so I guess that doesn't work.

You could ask MadCap, but I'd guess it's just not officially supported - since the image doesn't display correctly in the XML editor, and there's no 'insert variable' button in the Insert image dialog.
scap
Propeller Head
Posts: 55
Joined: Tue Jun 28, 2022 7:36 am

Re: Using variables in paths

Post by scap »

Troy, I've never considered this.

What are the specific use cases?
TroyWells
Propeller Head
Posts: 58
Joined: Sat Feb 04, 2006 5:27 am

Re: Using variables in paths

Post by TroyWells »

The use case for me is that I have topics that are mostly the same but the screen shots are different for every client. I want to use a variable to point to a different folder for every client. The file names for the screen shots are the same. Only the folder is different.

This functionality already exists for hyperlinks. While implemented differently, it also already exists in Lingo where you have different screen shots for each language.

MadCap just needs to take the step to formally support this in Flare and make it work for Word, like it already does for PDF and HTML5.
ChoccieMuffin
Senior Propellus Maximus
Posts: 2632
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Using variables in paths

Post by ChoccieMuffin »

TroyWells wrote: Wed Mar 13, 2024 4:30 am The use case for me is that I have topics that are mostly the same but the screen shots are different for every client. I want to use a variable to point to a different folder for every client. The file names for the screen shots are the same. Only the folder is different.

This functionality already exists for hyperlinks. While implemented differently, it also already exists in Lingo where you have different screen shots for each language.

MadCap just needs to take the step to formally support this in Flare and make it work for Word, like it already does for PDF and HTML5.
Sounds like a feature request is needed. See my footer for a link to add one. :)
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Post Reply