Two versions on published page using versioning script

This forum is for Single-Sourcing your Flare content to multiple outputs.

Two versions on published page using versioning script

Postby Dinnit on Mon Sep 25, 2017 12:33 am

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-filters-in-html5-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
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

Postby Rene Severens on Mon Sep 25, 2017 5:29 am

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

Re: Two versions on published page using versioning script

Postby Dinnit on Mon Sep 25, 2017 6:20 am

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
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

Postby Dave Lee on Mon Sep 25, 2017 7:07 am

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"
Dave Lee
Master Propellus Maximus
 
Posts: 5770
Joined: Mon Mar 05, 2007 8:33 am
Location: UK

Re: Two versions on published page using versioning script

Postby Rene Severens on Mon Sep 25, 2017 7:23 am

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

Re: Two versions on published page using versioning script

Postby Dinnit on Thu Sep 28, 2017 8:25 am

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
Dinnit
Propeller Head
 
Posts: 87
Joined: Tue Nov 13, 2007 5:51 am
Location: Stroud, Glos, UK


Return to Single-Sourcing

Who is online

Users browsing this forum: No registered users and 3 guests