Page 1 of 1

Export a file twice to a single output with dif conditions?

Posted: Tue Mar 05, 2019 1:23 pm
by aritchie
I would like to be able to use a file twice to the same HTML output, where the first use applies image A and the second use applies image B. Will I be able to do this?

In my TOC, I am able to insert the same file twice. Using the Properties tab, I can then assign the first placement of the file in the TOC the condition that will use image A. For the second placement of the file, I can assign the other condition that will use image B. When I build the target, however, both versions of the file include both image A and image B.

I have only started to use conditions, but it seems I can't apply different conditions to single file for the same target. The file can appear twice but has to output to the same condition.

Re: Export a file twice to a single output with dif conditio

Posted: Tue Mar 05, 2019 4:39 pm
by SteveS
Welcome to the forums :D

Have you considered applying the conditions to the images?

You can use conditions to say use this image for this output but not the other output.

Edit:
Now I've read your post again I can see I misunderstood. @Psider is on the right track.

Re: Export a file twice to a single output with dif conditio

Posted: Tue Mar 05, 2019 5:17 pm
by Psider
If you need different images for the same topic in a single output, the only way I can think of is create two snippets of the content before and after the specific image, then include those snippets in two different topics and insert the relevant image between the snippets. Then insert those two topics into the relevant place in the TOC.

Re: Export a file twice to a single output with dif conditio

Posted: Wed Mar 06, 2019 3:50 am
by ChoccieMuffin
Psider wrote:If you need different images for the same topic in a single output, the only way I can think of is create two snippets of the content before and after the specific image, then include those snippets in two different topics and insert the relevant image between the snippets. Then insert those two topics into the relevant place in the TOC.
I would do it slightly differently, and once you've created the condition tag set the solution can be used in as many places as needed.

* Create a condition tag set called "snippet_conditions.flcts" or similar. (This is just helpful practice, so you keep snippet conditions separate from conditions you use in targets or imports.) In that condition tag set, create two conditions, for the sake of argument let's call them A and B.
* Create two separate topics, one for A and one for B, and include each topic in the correct places in the TOC. (This is also good practice, as it means any breadcrumbs you have in your help point to the correct place in the TOC - if you have the same topic in two places, breadcrumbs don't recognise which instance you want if you find the topic when using search.) I like to include the first heading in the topic, but this isn't essential.
* Create a snippet that contains the body text and both images, and apply the appropriate snippet condition to each image. (If you have other things, like bits of text, that differ between A and B you can also include both bits of text and apply your snippet conditions as appropriate.)
* Insert the snippet into each topic. At first, both images appear, but don't fret - here's the clever bit...
* In each topic, in the structure bar right-click the snippet and on the menu click Snippet conditions, and in the dialog box select the appropriate condition from the condition tag set you created earlier.
* When generating your target, completely ignore the snippet_conditions tag set - you've already dealt with them at the topic level.

Once you've created the condition tag set you can use the same solution anywhere you need to, and you don't need TWO (or more) snippets for the topic content just in order to use different images.

Re: Export a file twice to a single output with dif conditio

Posted: Wed Mar 06, 2019 6:51 am
by aritchie
Wow, what a response! I didn't expect replies so soon. Thanks for also interpreting my use of the term "file" as topic, which is what I meant. I didn't think to use snippets in this way and apply conditions to them, as ChoccieMuffin outlined. It sounds like I still need to create two topics, but with the use of snippets I can still try to make the most of single-sourcing. Thank you, everyone.

Re: Export a file twice to a single output with dif conditio

Posted: Wed Mar 06, 2019 4:15 pm
by Psider
Oh yeah, I keep forgetting snippet conditions, as they didn't exist when I was using Flare regularly. :)

Re: Export a file twice to a single output with dif conditio

Posted: Mon Mar 11, 2019 3:21 am
by ChoccieMuffin
aritchie wrote:Wow, what a response! I didn't expect replies so soon. Thanks for also interpreting my use of the term "file" as topic, which is what I meant. I didn't think to use snippets in this way and apply conditions to them, as ChoccieMuffin outlined. It sounds like I still need to create two topics, but with the use of snippets I can still try to make the most of single-sourcing. Thank you, everyone.
Snippet conditions have been a godsend! And yes, two topics but the content of them is basically Line 1 = title, Line 2 = link to snippet. Piece of cake! Do hunt in the Flare help for snippet conditions to get a thorough explanation of them, and how to use them.