The name of that file suggests it was probably downloaded from my site, or possibly Willam van Weelden's. Both sites have instructions for using the script.
In each topic the path to the JS file has to be set as I describe. I suspect the problem is that your master page has a path that does not work for the topic.
See www.grainge.org for RoboHelp and Authoring tips
Given the fact that the file name is twisty2a.js, I believe you use my twisty method that Peter provides on his site.
The following should fix it: On line 55, set the variable OneButtonMethod to false.
Thanks, William. You and Peter have provided me some useful information. Now I just need to figure out how the previous writer set things up and then fix the project. Here are some notes about the project, which I am trying to troubleshoot:
- The previous writer had an old master page with a single Show All button, but not a Hide All button. btnhideall.gif is the only image included in the baggage files. btnshowall.gif is located in the root folder, as is twisty2a.js.
- Some topics include the Show All | Hide All hyperlink, while some include the Show All button (even when there are not drop-downs in the topic). I assume that the writer manually inserted the Show All button in those topics.
- Topics that contain the Show All button use the same Master Page that includes the Show All | Hide All hyperlink, which then does not appear in the topic.
Here's what I think I need to do:
- Figure out whether to use the hyperlink Show More | Show Less or the two-button Show All | Hide All approach.
- Edit the master page to use the selected approach.
- Edit the script as needed.
If the master page includes the Show All | Hide All buttons in every topics and there are no drop-downs in the topic, may I assume that they simply do nothing?
When you add the ShowAll/HideAll to the master page, the links will be visible regardless of whether dropdowns/expandspots are used on that page. If you do not want that behaviour, you will need a script to check for dropdowns/expandspots and then show the links.
I've been trying to follow Peter's instructions, but am having some difficulties.
- It's not clear to me what the difference is between "Twisty Images" and the "Show/Hide" buttons. Do I care about "Twisty Images" if I want to just include two buttons on every page, "Show All" and "Hide All"? I did a search for RoboHelp twisties and found information in Adobe RoboHelp 8, but can't tell if that feature went away with RH9 -- I cannot find a Drop-down hotspot style in the Styles dialog box.
- In "Referencing the script", Peter says to add the script type line to the head section of your topic -- I added it to the Head section of the Master page (via Design view), but am not sure that this works from a Master page. Do I need to add this line to every topic?.
- I did not change the "arrowright.gif" and "arrowdown.gif" references because I don't know what they're supposed to do.
- I added the Show All and Hide All buttons to the Master page, and set the variable to "btnshowall.gif" and "btnhideall.gif", but the buttons do not appear on every topic page (even though the topic uses the Master page).
- The script says to add an onclick for ShowAll and HideAll, but I can't find any way to do this when I right-click the image.
A twisty is the image shown before the drop-down link. The show/hide buttons are the images you use for setting up the show and hide all capabilities.
You can also add the script to the header section of the master page. That way you won't need to reference the script on every topioc separately.
The arrowright and arrowdown are the default image names used for the twisty. You don't need to change them if you don't use twisties.
You can't add the onclick event through the image properties. Go to HTML mode and add an attribute onclick="Code here" to the images.
Thanks again, William.
Now I understand what the twisty images are. I've never used them, always just accepted whatever RoboHelp included with the drop-down hot spot.
Here's what I've done:
- Added the Show All button to the Master page. (I decided to go with the single button approach.)
- Added the script to the header section of the Master page. The script is stored at the root of the Help project (Product\Help) and is in the Baggage Files project folder.
- Added the "name="ShowALL(this) " text to the btnshowall.gif properties in the HTML code. btnshowall.gif and btnhideall.gif are stored at the root of the Help project and are in the Baggage Files project folder.
I didn't add the OnClick event yet because I wasn't sure where to add the attribute in the HTML code.
The Show All works beautifully in some topics, but not in all. For some reason, and this may be the subject of another forum post, the updates to the Master page are not being applied to every page that uses the Master page. For example, the Application Home page topic looks like this:
When I compare the HTML code for this page to the HTML code for a topic where the Show All/Hide All works, the header includes the reference to twisty2a.js. Do you think that this is a RoboHelp issue that I need to report and that, as a workaround, I need to manually add the script reference to every topic now?
- The reference to twisty2a.js is in the "head" block below the link to default.css.
- I'm in the process of removing the "Show More | Show Less| links and the Show All buttons that appear to have been manually entered in topics.
- The Show All button is now in the Header area of the Master page -- I deleted it from its previous location in the table in the Body placeholder.
- I'm using the single button method. The following is the code for the button. I didn't realize earlier that I needed to replace "name" with "onclick" in the instructions that I was following (not being at all experience with HTML code or scripting).
<td><h2><img src="btnshowall.gif" onclick="ShowAll(this)" alt="" style="border: none;" border="0" /></h2></td>
- For future reference: when I see a button in a topic, rather than a placeholder for the buttom (such as Image btnshowall), I'll know that the button is not coming from the master page!
Thanks again to Peter, Rick, and William for all your thoughtful and speedy assistance.
I'm using RH9.
William suggested adding the script to the header section of the master page, to avoid having to reference the script on every topic separately.
Unfortunately, the workaround appears to be that I need to copy the ‘script type’ line into all the old topics that don’t take the master page changes.
I tried setting master page to “none” and then reapplying it, but that didn’t work either.
You are seeing what I call the "Master Page Conundrum" at play here.
Master Pages are used in two completely different ways.
The first way is similar to using a copier. Imagine you have a form where you want to collect information at some event. So you create the form and it has places for the Name, Address, Phone Number, etc. You place the form inside the copier and make 20 copies. Each copy made looks identical to the other until the areas are completed by the person you handed the form to.
Later it occurs to you that it would be handy to also ask for their email addresses. So you amend the original form. Now those first 20 copies aren't going to magicakally see a new field appear where someone can fill in their email address, right? Only NEW copies made from the amended form will get that. Same goes for Master Pages. The first way they are used is to serve in much the same capacity as the form example. Any changes made to the topic once it has been created aren't reflected in topics that were created from the master page.
The *SECOND* way Master Pages are used is to easily propagate Headers and/or Footers across existing topics. So you set the Master Page up so that it has a Header and/or Footer, then you associate it with as many existing topics as you want in order to give each of these topics the same Header and/or Footer. If you make changes to the Header or Footer in the Master Page, those changes *ARE* reflected in all topics linked to the Master Page.
Hopefully this helps demystify things a bit... Rick
Thanks for the additional explanation about the conundrum, Rick!
As far as the first "copier" usage, I assumed that changes made to a regular (non-Master Page) topic would not be reflected in any other topics that use the same Master Page.
However, I also assumed that changes made to content on a Master Page would be reflected in topics associated with the modified Master Page. I just did a brief test:
- Opened the Master Page and added "This is a test." in the area above the footer (and below the body area). Saved the change.
- Opened a topic associated with the Master Page and then previewed it. "This is a test." appears in the previewed version.
In this scenario, using your "copier" usage method, adding an email address to a Master Page 'form' would add the email address to all topics associated with the modified form.
In the second method, using Master Pages to propagate Headers and Footers across existing topics, I assumed that adding the twisty script to the <head> section in the Master Page would propagate that change across existing topics. However, I may have confused the <head> section with the "header" type area. If I change an image in the header, the change is correctly reflected in all topics that use the Master Page.
Assuming that twisty2a.js is (1) in the root folder, (2) is set up to use the “One button ShowHide only” method, and (3) has been added to the Baggage Files folder:
- Open WebHelp.
- Open every topic and click the Show All button in the header area.
- If the script error occurs, open the topic in RoboHelp.
- Click the HTML tab.
- In the <head area>, make sure that the twisty2a.js script is included.
- Click the Design tab and then save the changes.
Note: If you don’t click the Design tab before saving the change, RoboHelp thinks you are making a change to the Master Page and may prompt you to apply the change to all topics associated with the Master Page. Sometimes this results in the images disappearing from the Master Page header area! You then have to insert them in the Master Page again. If you choose not to apply the change to all topics associated with the Master Page, RoboHelp tells you that you are breaking the link to the Master Page for that topic (which is not always true!).