Copy link to clipboard
Copied
so I have this code in the header of my Master page in RoboHelp:
<input type="image" value="View graphics legend"
onclick="window.location.href='Graphics_legend.htm'"
src="Images\graphic legend.png" name="image1"
title="View graphics legend" style="width: 118px; height: 21px;" />
i need to call the 'Graphics_legend.htm' file which is sitting in the root folder. When i try this it works fine for the html file which are in the root folder as well, but anything with is in a sub directory , the button stops working.
It might be just to add a realtive path ,but i am failing to understand how to make a relative path for 'Graphics_legend.htm' ,.. ?
Copy link to clipboard
Copied
Hi there
Relative paths are relatively simple once you get the hang of them.
For example, if you want to refer to something that is one folder above where you are, you prefix things with ../
The ../ is HTML shorthand meaning one folder level above where I am. If you wish to go two folder levels up, ../../
If you need to drop into a folder that is at the same level as where you are, ../FolderName
From what you have written it would seem that RoboHelp isn't seeing your code and properly calculating the path. That's really not too surprising because you are using the Button element.
If you are using CSS and linking to a style sheet you likely have a simple way to calculate what the relative path should be. Just examine the source code of the topic and note what prefixes the CSS file name. Assuming your CSS is in the project root (and it should be) then you could use the same prefix.
Hopefully this helps... Rick
Helpful and Handy Links RoboHelp Wish Form/Bug Reporting Form Begin learning RoboHelp HTML 7, 8 or 9 within the day! |
Copy link to clipboard
Copied
If you need to drop into a folder that is at the same level as where you are, ../FolderName
I think that is a typo and that Rick meant ./FolderName. (A single full stop / period)
See www.grainge.org for RoboHelp and Authoring tips
Copy link to clipboard
Copied
this is what is in the header of the master page for the css
<link rel="StyleSheet" href="SHARQ_MO_2_1_2011.css" type="text/css" />
i think my button will need some scripting so that it can calculate the relative path ... or maybe .. is there some way just to point to the root directory level, regardlerss of what level the call was made from ??
Copy link to clipboard
Copied
Hi,
See http://www.wvanweelden.eu/robohelp/scripts/projectroot for a JavaScript function that returns the project root for any topic in your project. (Only works in output, not in preview.)
Greet,
Willam
Copy link to clipboard
Copied
thanks Van.
but my next question would be how do I call that function in the button code ? I'm not an html programer, i can just understand the code ... i really dont know how to call functions ...
Copy link to clipboard
Copied
Hi,
First off, you need to make the function available for all topics, for example by adding the script to a JavaScript file or putting it in the header/footer of the masterpage. The button should do something like this:
onclick="RedirectToLegend()"
You can then add a function like this:
function RedirectToLegend() {
var Topic = "Graphics_legend.htm";
var Path = RootPath();
document.location = Path+Topic;
}
You can add the script, including the function RootPath by selecting an isertion point, then selecting Insert > HTML > Advanced > Script. Just paste the code in the "Source" tab.
Greet,
Willam
Copy link to clipboard
Copied
Hello again
What I meant was for you to look at the reference for a base topic and not the master page. The master page will always be in the project root and the leading information won't be there.
You may need to examine a topic in output.
Cheers... Rick
Helpful and Handy Links RoboHelp Wish Form/Bug Reporting Form Begin learning RoboHelp HTML 7, 8 or 9 within the day! |