Variables in the external file name

This forum is for all Flare issues not related to any of the other categories.
Post Reply
Dodo1
Propeller Head
Posts: 23
Joined: Tue Nov 18, 2008 6:39 am

Variables in the external file name

Post by Dodo1 »

Is there any way how to create the reference to the external *.chm file to be variable-dependent in the sense of the opened file? The code in the part of the text is as follows:

Code: Select all

<a onclick="parser ('Clarity.chm');" style="text-decoration: underline;cursor: hand;font-size: 8pt;">Click here to open the <MadCap:variable name="oem.Clarity" /> Main help</a>
I'm able to OEM-ize the software name in the text of the link using Variables (as can be seen in the code part), but I would like to call differently named *.chm file based on the variables in the output (some OEM partners do not have the same name of the *.exe file and thus the *.chm file as our main product). Is there any way how to do that? I tried to change the Clarity.chm part in the code by the <MadCap:variable name="oem.ClarityChm" /> variable part, but that doesn't seem to work, < tags are not allowed there...
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: Variables in the external file name

Post by KevinDAmery »

No: embedding a tag set (such as a variable) inside another tag is illegal in the XML standard. You could use a variable to control the link text (nesting tags is allowed), but you could not to change the link itself because that would require putting the variable tag inside the a tag definition.

You might be able to do something with javascript to replace the entire link on the fly. A simpler approach, though, would be to add separate links to all the appropriate CHM files, then apply conditions to each link to include / exclude them as appropriate.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
Dodo1
Propeller Head
Posts: 23
Joined: Tue Nov 18, 2008 6:39 am

Re: Variables in the external file name

Post by Dodo1 »

Thanks for the answer, I feared that it would be so. Unfortunately, your solution would currently need 20+ conditional texts due to the number of OEM versions we would need, which (I fear) is not worth the effort. Thank you anyway.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Variables in the external file name

Post by LTinker68 »

I don't know if this will work, but someone was trying to put a variable as part of a hyperlink and what they ended up doing was copying the way the variable was added to a TOC entry and pasting that code into the hyperlink, and it worked. I'm not sure if that would work here, but you could try it. Look in the Flare help or the MadCap knowledgebase for how to use variables in TOC entries.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
GregStenhouse
Sr. Propeller Head
Posts: 330
Joined: Tue May 13, 2008 3:27 pm
Location: Christchurch, New Zealand

Re: Variables in the external file name

Post by GregStenhouse »

I think your only option is to convert the madcap variable into a Javascript variable, and then use that in your event handler for the A link. One way would be to include a hidden paragraph, and then a small script that sets up a Javasscript variable with the text of that paragraph. You could include this code at the top of your masterpage

Code: Select all

<div id="helpName" style="Display:None">
  <MadCap:variable name="oem.Clarity" />.chm
</div>
<script type="text/javascript">
  var helpName=document.getElementById("helpName").innerHTML;
</script>
Then in your "<a onClick " link, include the Javascript variable

Code: Select all

<a onclick="parser (helpName);"
Post Reply