Varaibles in Hyperlinks
-
- Jr. Propeller Head
- Posts: 8
- Joined: Mon Apr 24, 2006 2:30 am
- Location: UK
- Contact:
Varaibles in Hyperlinks
Hi,
Not having much luck inserting a system variable within a hyperlink, and wondered if anyone can point out where I am going wrong.
I would basically like a very simple error report message at the bottom of each page, logically it would be;
<a href="http://www.myhomesite.co.uk/help/errorr ... File">Tell us about a problem on this page</a>
Where magically the mcvariable:System.SourceFile is replaced uniquely for each page.
I've looked at "User Interface Elements - How to Use Each One > Inserting Variables into Topics" which implies that a link can contain a variable but isn't clear how to achieve this via the UI. I end up with the call being made without any variable substitution.
I have tried defining my own variable with a value
<pre>http://www.myhomesite.co.uk/help/errorr ... eFile</pre>
and then inserting this as a variable on the page mcvariable:MyVaraibles.Feedbacklink but that doesn't seem to work either.
I believe the end result could all be inserted in a snippet and then placed appropriately on each page.
Thanks in advance.
Not having much luck inserting a system variable within a hyperlink, and wondered if anyone can point out where I am going wrong.
I would basically like a very simple error report message at the bottom of each page, logically it would be;
<a href="http://www.myhomesite.co.uk/help/errorr ... File">Tell us about a problem on this page</a>
Where magically the mcvariable:System.SourceFile is replaced uniquely for each page.
I've looked at "User Interface Elements - How to Use Each One > Inserting Variables into Topics" which implies that a link can contain a variable but isn't clear how to achieve this via the UI. I end up with the call being made without any variable substitution.
I have tried defining my own variable with a value
<pre>http://www.myhomesite.co.uk/help/errorr ... eFile</pre>
and then inserting this as a variable on the page mcvariable:MyVaraibles.Feedbacklink but that doesn't seem to work either.
I believe the end result could all be inserted in a snippet and then placed appropriately on each page.
Thanks in advance.
-
- Propellus Maximus
- Posts: 1985
- Joined: Tue Jan 23, 2007 8:18 am
- Location: Darn, I knew I was around here somewhere...
Re: Varaibles in Hyperlinks
I'm not clear what the problem is exactly: are you having problems inserting the variable, or is it not being applied properly when you build your output?
Until next time....
Kevin Amery
Certified MAD for Flare
Kevin Amery
Certified MAD for Flare
-
- Jr. Propeller Head
- Posts: 8
- Joined: Mon Apr 24, 2006 2:30 am
- Location: UK
- Contact:
Re: Varaibles in Hyperlinks
Hi
A bit of both really...
1) Should I insert a hyperlink and in the link add the mcvariable:System part or
2) Generate a MyVariable containing the hyperlink and mcvariable:System element and insert the variable in the document.
Should <ctrl>leftclick on allow the resultant element from above to be activated or will the replacement only work in a finalised and published project? (<ctrl>leftclick at present it opens a hyperlink without doing the replacement)
A bit of both really...
1) Should I insert a hyperlink and in the link add the mcvariable:System part or
2) Generate a MyVariable containing the hyperlink and mcvariable:System element and insert the variable in the document.
Should <ctrl>leftclick on allow the resultant element from above to be activated or will the replacement only work in a finalised and published project? (<ctrl>leftclick at present it opens a hyperlink without doing the replacement)
-
- Propellus Maximus
- Posts: 1985
- Joined: Tue Jan 23, 2007 8:18 am
- Location: Darn, I knew I was around here somewhere...
Re: Varaibles in Hyperlinks
This is how I would do it. Usually I create the hyperlink first, then insert the variable inside it. I haven't tried with system variables (only with "normal" variables) but the principle should be the same.GCotgreave wrote:Hi
A bit of both really...
1) Should I insert a hyperlink and in the link add the mcvariable:System part
I don't know if variables containing link text will work - but in any case, since variables are defined in the target you may end up with the same link in each topic by doing this. You could try it, but I think it's likely to be more problematic.or
2) Generate a MyVariable containing the hyperlink and mcvariable:System element and insert the variable in the document.
You would only see it in the output. When you build the output the variable should be replaced with the appropriate text, creating a valid link. Until then, it contains the variable code so the link won't go anywhere that exists.Should <ctrl>leftclick on allow the resultant element from above to be activated or will the replacement only work in a finalised and published project? (<ctrl>leftclick at present it opens a hyperlink without doing the replacement)
Until next time....
Kevin Amery
Certified MAD for Flare
Kevin Amery
Certified MAD for Flare
-
- Jr. Propeller Head
- Posts: 8
- Joined: Mon Apr 24, 2006 2:30 am
- Location: UK
- Contact:
Re: Varaibles in Hyperlinks
Thanks for your help so far,
When I look at the code in Flare
<a+> Feedback <MadcapVaraible/> [Sysytem.SourceFile] </a>
Whereas it should be inside the <a+> component which is href = http://www.myhomesite.co.uk/help/form.php?filename= inorder to be placed at the end of the href and not as part of the link's text component. Flare doesn't seem to want to allow me to edit the <a+> component directly . Any more clues as to where I'm going wrong?
But I'm not quite there, We are getting correct substitution, but not quite in the correct place. I think I'm being a bit dense on inserting the variable. The variable is ending up in the wrong part of the tag ;KevinDAmery wrote:GCotgreave wrote:Hi
This is how I would do it. Usually I create the hyperlink first, then insert the variable inside it. I haven't tried with system variables (only with "normal" variables) but the principle should be the same.
When I look at the code in Flare
<a+> Feedback <MadcapVaraible/> [Sysytem.SourceFile] </a>
Whereas it should be inside the <a+> component which is href = http://www.myhomesite.co.uk/help/form.php?filename= inorder to be placed at the end of the href and not as part of the link's text component. Flare doesn't seem to want to allow me to edit the <a+> component directly . Any more clues as to where I'm going wrong?
-
- Propellus Maximus
- Posts: 1985
- Joined: Tue Jan 23, 2007 8:18 am
- Location: Darn, I knew I was around here somewhere...
Re: Varaibles in Hyperlinks
Ahhh.... I missed that. I usually place variables to change the text of the link, not the code. Hm, not sure if that will work after all. This would require putting the variable tag inside the a link tag, which may not be valid XML.
In any case, I wouldn't use the "code view" to check this. Code view is, IMO, next to useless. Instead, if you need to get into the code I would open the topic in a text editor (Flare has a built in one, or you can use an external one if you prefer). Just make sure you back up the topic before making the change, because as I mentioned this may not be valid XML so the topic may not open in the XML editor after making the change.
In any case, I wouldn't use the "code view" to check this. Code view is, IMO, next to useless. Instead, if you need to get into the code I would open the topic in a text editor (Flare has a built in one, or you can use an external one if you prefer). Just make sure you back up the topic before making the change, because as I mentioned this may not be valid XML so the topic may not open in the XML editor after making the change.
Until next time....
Kevin Amery
Certified MAD for Flare
Kevin Amery
Certified MAD for Flare
-
- Propeller Head
- Posts: 62
- Joined: Sat Dec 10, 2005 8:06 pm
- Location: Calgary, AB Canada
Re: Varaibles in Hyperlinks
What is the answer to the question, "How do you place a Flare system variable, e.g. the filename, within the anchor tag"? I embed an email link on every page and would like to include the filename as part of the Subject. Everything else about the link works as expected. I just can't get the filename in there.
Craig Prichard
craig.prichard@gmail.com
craig.prichard@gmail.com
-
- Jr. Propeller Head
- Posts: 8
- Joined: Mon Apr 24, 2006 2:30 am
- Location: UK
- Contact:
Re: Varaibles in Hyperlinks
In the end one of our web developers came up with a solution.
We publish HTML help shipped with our product, so that it looks the same regardless of the OS platform they choose. At the bottom of each help page is a link which takes them back to a dynamic webpage on the company server. This is pre-filled with topic and file name information allowing us to see exactly which help page they are commenting on.
This link could easily be the email that you mention
This is basically a hack around the issue in Flare not correctly replacing information in links.
Step 1 = Declare a CSS Class called footer and add it to the cell/link you want to modify
Step 2 = Add the Flare variables to the link you wish to use in the footer, each variable will be output in a span tag.
Step 3 = Add a custom JS file that contains the code to resolve the variables into the required link we called ours footer.js
When the script is loaded it automatically runs the containing function which resolves the span tags into the required link.
Below is the content of footer.js which generates our link back to the website.
We publish HTML help shipped with our product, so that it looks the same regardless of the OS platform they choose. At the bottom of each help page is a link which takes them back to a dynamic webpage on the company server. This is pre-filled with topic and file name information allowing us to see exactly which help page they are commenting on.
This link could easily be the email that you mention
Craig.Prichard wrote:I embed an email link on every page and would like to include the filename as part of the Subject.
This is basically a hack around the issue in Flare not correctly replacing information in links.
Step 1 = Declare a CSS Class called footer and add it to the cell/link you want to modify
Step 2 = Add the Flare variables to the link you wish to use in the footer, each variable will be output in a span tag.
Step 3 = Add a custom JS file that contains the code to resolve the variables into the required link we called ours footer.js
When the script is loaded it automatically runs the containing function which resolves the span tags into the required link.
Below is the content of footer.js which generates our link back to the website.
Code: Select all
// JavaScript Document
2
3createFooter();
4
5function createFooter() {
6 var theFooter;
7 var theFooterList;
8 var theSpanList;
9 var i, j;
10 var varA = "";
11 var varB = "";
12 var strHTM = "";
13
14 theFooterList = document.getElementsByTagName("a");
15
16 for (i=0; i < theFooterList.length; i++) {
17 theFooter = theFooterList[i];
18 if (theFooter.className == "footerlink") {
19 theSpanList = theFooter.getElementsByTagName("span");
20 varA = theSpanList[0].innerHTML;
21 varB = theSpanList[1].innerHTML;
22 break;
23 }
24 }
25
26// strHTM += "<a href=\"http://www.mycompanywebsite.co.uk/pages/help/form.php?topicname=" + varA + "&filename=" + varB + "\" title=\"\" target=\"_NEW\">Click Here</a>";
27 theFooter.innerHTML = "click here";
28 theFooter.href = "http://www.mycompanywebsite.co.uk/pages/help/form.php?topicname=" + varA + "&filename=" + varB;
29 theFooter.title = "click here to comment on our help system";
30 theFooter.target = "_new";
31}
Re: Varaibles in Hyperlinks
Hi there,
I know this is years later, but I thought I would post another solution. Our group has been trying to accomplish the same thing, and we didn't think about system variables until after a few days of racking our brains.
We have a hyperlink on a master page that goes to a survey that gathers feedback regarding our help files. We wanted to know what page the user was on when he/she clicked on the link to get to the survey.
Anyway, through trying different things, we found that if you use the following syntax, your hyperlink will show the information in the system variable: [=%System.Title%] (or whatever variable that you want to capture).
Our hyperlink that is on the masterpage looks something like this:.
When the user clicks the link and is taken to the survey page, the link in the url window looks like this:.
Hope that saves some headaches for someone!
I know this is years later, but I thought I would post another solution. Our group has been trying to accomplish the same thing, and we didn't think about system variables until after a few days of racking our brains.
We have a hyperlink on a master page that goes to a survey that gathers feedback regarding our help files. We wanted to know what page the user was on when he/she clicked on the link to get to the survey.
Anyway, through trying different things, we found that if you use the following syntax, your hyperlink will show the information in the system variable: [=%System.Title%] (or whatever variable that you want to capture).
Our hyperlink that is on the masterpage looks something like this:
Code: Select all
<a href="http://surveylink.com/feedback/?product=ourproduct&type=help&id=[%=System.Title%]&version=2.00>
When the user clicks the link and is taken to the survey page, the link in the url window looks like this:
Code: Select all
http://surveylink.com/feedback/?product=ourproduct&type=help&id=UsingOurProudct&version=2.00
Hope that saves some headaches for someone!
-
- Jr. Propeller Head
- Posts: 4
- Joined: Fri Feb 02, 2018 9:32 am
Re: Varaibles in Hyperlinks
I can confirm that using '[%=VARIABLESET.VARIABLENAME%]' works great in Flare 2017 r3.
Re: Varaibles in Hyperlinks
In recent versions, this format used to be documented in the Flare help, but it seems it's fallen out in 2017r3 help.
The formats still work. When you are using a variable someplace other than in literal text elements of a page:
The formats still work. When you are using a variable someplace other than in literal text elements of a page:
- If the variable makes up the entire text of its entry (for instance, an entire TOC entry or the entire destination of a link), enter the text mcvariable:VariableSet.VariableName
- Otherwise, type it this way: [%=VariableSet.VariableName%]
-
- Propeller Head
- Posts: 51
- Joined: Thu Dec 27, 2018 10:35 am
- Location: Goleta (Santa Barbara County), CA
- Contact:
Re: Varaibles in Hyperlinks
Hi,
We use the following variables to create PDF file names in our PDF targets:
What I've been trying to do in our HTML5 help but without any luck is to use these variables in hyperlinks. For example, I've added the following link to our master page:
While the link text comes out correctly the link itself does not. From the posts above it sounds like this should work but it doesn't Any ideas?
Thanks,
Brian
We use the following variables to create PDF file names in our PDF targets:
Code: Select all
[%=Cover Variables.P/N:%] [%=Cover Variables.Product Name%] [%=Cover Variables.PDFGuideTitle%]
Code: Select all
<div class="Note">Download the <img src="../Images/PDF_24.png" style="mc-thumbnail: none;width: 24px;height: auto;" /> <a href="../../PDFs/[%=Cover Variables.P/N:%] [%=Cover Variables.Product Name%] [%=Cover Variables.PDFGuideTitle%].pdf" target="_blank">[%=Cover Variables.P/N:%] [%=Cover Variables.Product Name%] [%=Cover Variables.PDFGuideTitle%]</a>.</div>
Thanks,
Brian
Flare + Analyzer 2022, Central, Capture 7.0, Mimic 8.1
-
- Senior Propellus Maximus
- Posts: 3669
- Joined: Thu Feb 02, 2006 9:57 am
- Location: Pittsford, NY
Re: Varaibles in Hyperlinks
I think the problem might be that you are putting the link on the masterpage. The link is relative, so when Flare tries to resolve it for each individual topic that is associated with that masterpage, the relative link that begins "<a href="../../PDFs/" (excluding the quotes I've used to frame this example) might work for some but not all topics. The relative link might need to be "../../../PDFs/" for some topics, while for others it would need to be "../PDFs/", depending on the location of each topic relative to where the PDFs are stored.
I recently achieved using variables for PDF filenames in hyperlinks myself, and I know it works, but I was putting the links into individual topics, not on the masterpage. Additionally, I wrote an article for the team I'm supporting to explain that if they wanted to set up similar links in other topics, they'd need to make sure that the relative path to the PDFs would be correct for each of those individual topics.
I recently achieved using variables for PDF filenames in hyperlinks myself, and I know it works, but I was putting the links into individual topics, not on the masterpage. Additionally, I wrote an article for the team I'm supporting to explain that if they wanted to set up similar links in other topics, they'd need to make sure that the relative path to the PDFs would be correct for each of those individual topics.
Nita
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
-
- Propeller Head
- Posts: 51
- Joined: Thu Dec 27, 2018 10:35 am
- Location: Goleta (Santa Barbara County), CA
- Contact:
Re: Varaibles in Hyperlinks
Nita,
Wow! Thank you for the quick response! And yes, you are 100% correct -- I'm trying to put this in the master page so the link is always available. I was able to get a PDF link in a master page to work but I did it by hard coding it, not using a relative link. Oh well, back to Square One.
Thanks,
Brian
Wow! Thank you for the quick response! And yes, you are 100% correct -- I'm trying to put this in the master page so the link is always available. I was able to get a PDF link in a master page to work but I did it by hard coding it, not using a relative link. Oh well, back to Square One.
Thanks,
Brian
Flare + Analyzer 2022, Central, Capture 7.0, Mimic 8.1