Page 1 of 1

Two versions on published page using versioning script

Posted: Mon Sep 25, 2017 12:33 am
by Dinnit
I temporarily need to publish a large number of topics where part of the content shows 2 different versions of the same software - the current version and a redesigned version. The help is to be published to one site.

I've used Thomas Tregner's script http://tregner.com/flare-blog/version-f ... l5-output/ (for which many thanks!) which does the job of allowing the user to choose which version to see. However, the initial page load shows both versions before the choice is made.

Does anyone know if it is possible to just show the current version on initial load and then the user can make the choice as to whether to leave as seen or choose the redesigned version?

Disclaimer - my Javascript knowledge is close to zero :|

Re: Two versions on published page using versioning script

Posted: Mon Sep 25, 2017 5:29 am
by Rene Severens
Hi,

I am not sure this is going to help you, but it is worth a try.

The version filter used contains a list of options. If you did exactly what is shown in the blog example of the link you added, then there is no option set as selected:

...
<option value="Default.1-0">1-0</option>
<option value="Default.2-0">2-0</option>
<option value="Default.2-1">2-1</option>
...

In using this in a complete different setting, I have created a similar selection list with 1 of these options set to be shown always first, as follows (using the example as above):

...
<option selected value="Default.1-0">1-0</option>
<option value="Default.2-0">2-0</option>
<option value="Default.2-1">2-1</option>
...

By setting one of the options as selected this way, the selected option is shown as default.
When a used selects another option, then the other option is shown.

Maybe this can help?

Greetings,
René Severens

Re: Two versions on published page using versioning script

Posted: Mon Sep 25, 2017 6:20 am
by Dinnit
Many thanks for looking at this. However, when I try to save after adding "selected" into my first line:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="1" MadCap:lastHeight="52" MadCap:lastWidth="1036">
    <head>
    </head>
    <body>
        <select id="version-select" onchange="showHideVersion()">			
            <option selected value="Default.1-0">Current Management</option>
            <option value="Default.2-0">New Management</option>
        </select>
    </body>
</html>
I'm getting an error on save in my text editor viz:

"XML parsing error at line 11
Extra content at the end of the document"

And Flare says 'value' is an unexpected token. The expected token is '='. Line 7, position 30.

Re: Two versions on published page using versioning script

Posted: Mon Sep 25, 2017 7:07 am
by NorthEast
Source topics in Flare use XHTML, so you can't use the HTML shorthand for attributes.

In XHTML, attributes need a value, you'd need to use:

Code: Select all

selected="selected"

Re: Two versions on published page using versioning script

Posted: Mon Sep 25, 2017 7:23 am
by Rene Severens
Hi,

That'll be correct. I use my own solution in HTML, not XHTML.

Greetings,
Rene Severens

Re: Two versions on published page using versioning script

Posted: Thu Sep 28, 2017 8:25 am
by Dinnit
Thanks both. That works for showing the current version option every time - but didn't in IE (who would guess) which unfortunately virtually all our customers use. FYI it turned out to be because we were publishing using the aspx extension. It's fine in html.

However, I'm still seeing both versions on the page - thinking about it, am I trying to do something that is not possible in Flare anyway? As both versions are in the topics won't I always initially see both before selecting the version needed as I can't do anything else but publish the full topic containing both versions? The version script is in a snippet btw but that shouldn't make any difference???