Two versions on published page using versioning script

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
Dinnit
Propeller Head
Posts: 87
Joined: Tue Nov 13, 2007 5:51 am
Location: Stroud, Glos, UK

Two versions on published page using versioning script

Post 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 :|
Ann
Started on Flare 3, now on Flare 2017 r2 + Capture (occasionally) and Analyser (very occasionally)
Windows 10 Enterprise
Rene Severens
Sr. Propeller Head
Posts: 210
Joined: Mon Sep 19, 2011 2:06 am
Location: Netherlands - Zoetermeer
Contact:

Re: Two versions on published page using versioning script

Post 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
"The numbers are strange today; they somehow do not seem to add up."
Dinnit
Propeller Head
Posts: 87
Joined: Tue Nov 13, 2007 5:51 am
Location: Stroud, Glos, UK

Re: Two versions on published page using versioning script

Post 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.
Ann
Started on Flare 3, now on Flare 2017 r2 + Capture (occasionally) and Analyser (very occasionally)
Windows 10 Enterprise
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Two versions on published page using versioning script

Post 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"
Rene Severens
Sr. Propeller Head
Posts: 210
Joined: Mon Sep 19, 2011 2:06 am
Location: Netherlands - Zoetermeer
Contact:

Re: Two versions on published page using versioning script

Post by Rene Severens »

Hi,

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

Greetings,
Rene Severens
"The numbers are strange today; they somehow do not seem to add up."
Dinnit
Propeller Head
Posts: 87
Joined: Tue Nov 13, 2007 5:51 am
Location: Stroud, Glos, UK

Re: Two versions on published page using versioning script

Post 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???
Ann
Started on Flare 3, now on Flare 2017 r2 + Capture (occasionally) and Analyser (very occasionally)
Windows 10 Enterprise
Post Reply