You are here: Features > Snippets > More About Snippets > Using Snippet Conditions

Using Snippet Conditions

Snippet conditions are condition tags that you can apply to content within snippets. With snippet conditions, you can separate certain snippet content so that it displays in some topics or master pages but not in others. This allows you to use one snippet for many purposes, rather than having to create multiple snippets. Whereas regular conditions are included or excluded at the target level, snippet conditions are included or excluded at the topic or master page level.

example

Let's say that you have a table with 15 rows and four columns. Suppose that the table needs to be included in 40 topics. Rather than copying and pasting the table 40 times, you create one snippet containing the table and insert it into those 40 topics. However, suppose that in 30 of those topics, you need to add three more rows to the table to explain something. In the remaining 10 topics, the three additional rows are not necessary. Otherwise, the table content is the same in all 40 topics. What do you do? You have a few options.

The first option is to add a note to the table explaining that the three additional rows are intended only for some of the topics but not others. However, this might be confusing to your readers.

The second option is to create two separate snippets—one for the 30 topics and another for the 10 topics. However, this means that you need to maintain identical information in two different places. And that is no way to single-source your content.

The third option is to create snippet conditions. Here is how you might do it in this example:

  1. Create a condition tag called "Additional Rows." See Creating Condition Tags.
  2. Open the snippet and add the necessary three rows to the table. See Opening Snippets and Inserting Table Columns and Rows.
  3. Using the table row structure bars, apply the new condition tag to the additional three rows. See About Structure Bars and Applying Condition Tags to Content.
  4. Use the File List window pane (View>File List) to select the 30 topics requiring the additional rows, and open the Properties dialog. See File List Window Pane and Properties Dialog (Topics).
  5. Select the Snippet Conditions tab.
  6. Next to the new condition tag, click the Include check box.
  7. Use the File List window pane to select the 10 topics not requiring the additional rows, and open the Properties dialog.
  8. Select the Snippet Conditions tab.
  9. Next to the new condition tag, click the Exclude check box.
  10. After you save all of your changes and generate the appropriate target, you will notice that the three additional rows are displayed only in the 30 topics where they were included. See Building Output.

For more information, see About Snippets, Creating Condition Tags, and Applying Condition Tags to Content.

How to use snippet conditions

  1. Create all of the condition tags that you plan to use for separating your snippet content.

    Note: The more variations that you will have in your snippet content, the more condition tags you will need to create. An average number is four to eight condition tags, but you may find that you require fewer or more tags than this for snippet content. It is always preferable to create more condition tags than you may need, rather than to realize later that you have too few. You can even create a separate condition tag set to be used specifically for holding your snippet condition tags (while keeping your regular condition tags in other tag sets).

    Tip: It is also a good idea to include the word "Snippet" somewhere in the name of a new snippet condition tag. This way, you can easily identify it, rather than confusing it with the regular condition tags that you use for other purposes (e.g., online output or printed output condition tags) .

    See Creating Condition Tags and Adding Condition Tag Set Files.

  2. Create and open the snippet.

    See Creating New Snippets from Existing Content and Opening Snippets.

  3. Apply the necessary condition tags to the text or other content in the snippet.

    See Applying Condition Tags to Content.

    Note: It is a good idea to click the Hide/Show Conditional Indicators button at the bottom of the local toolbar so that you can clearly see where the different tags have been applied in the snippet.

  4. Insert the snippet into the necessary topics, or determine which topics already contain the snippet.

    See Inserting Snippets into Topics and Viewing Link Dependencies.

  5. After you determine that a particular topic should display only certain tagged content from the inserted snippet, open the Content Explorer and select the topic file.

    Note: If there are several topics that you know in advance will include a particular snippet condition tag, you can open the File List window pane (View>File List) instead and select all of those files at the same time.

  6. In the local toolbar, click .

    The Properties dialog for the topic opens.

  7. Select the Snippet Conditions tab.
  8. Next to the snippet condition tag(s) to be displayed in the topic, click the Include check box.
  9. Next to all of the snippet condition tag(s) not to be included in the topic, click the Exclude check box.

    By default all snippet tags will be included in the topic unless you specify otherwise by clicking Exclude.

    Why is there an Include check box if all tags are included by default? The Include check box is necessary in case you have two or more tags associated with the same content and there is a conflict.

    example

    Suppose you have two condition tags in your snippet—one called "Beginner" and another called "Advanced." Let's say that you have a snippet containing three paragraphs. You apply the "Advanced" tag to the first two paragraphs, and you apply the "Beginner" tag to the last two paragraphs.

    You have created a topic called "Advanced Set Up." For this topic, you obviously want to include all snippet content associated with the "Advanced" tag, but you want to exclude snippet content associated with the "Beginner" tag.

    By default, Flare will include snippet content associated with both tags, unless you tell it not to. So you tell Flare to exclude the content associated with the "Beginner" tag. The problem is the middle paragraph from the snippet mentioned above. It is associated with both tags. You have told Flare to exclude content associated with the "Beginner" tag, and it will do so, overriding the default. But you want to make sure that paragraph is included in the "Advanced Set Up" topic. That is why you need to make sure you select the Include check box next to the "Advanced" tag.

    This is why it is a good idea to create enough snippet condition tags in advance. If sometime later you realize you need to create additional snippet condition tags, you may find that you need to revisit all of the topics where you have already inserted snippets with conditions. Why? Because by default the snippets containing the new tags will be displayed in all topics unless you specify otherwise.

  10. Click OK.

See Also

Downloads (PDF Format):

Flare Quick Guide

Flare Getting Started Guide

Flare What's New Guide

Flare Key Features Guide

Flare Transition From RoboHelp Guide

Flare Transition From FrameMaker Guide

Flare Styles Guide

Flare Printed Output Guide

Flare Shortcuts