tags in snippets in master pages, control at file level

This forum is for Single-Sourcing your Flare content to multiple outputs.
Post Reply
john
Jr. Propeller Head
Posts: 9
Joined: Fri May 03, 2013 5:50 am

tags in snippets in master pages, control at file level

Post by john »

Hello Everyone

I am writing a manual that requires the following information at the bottom of the page:
- "controlled document", or
- "uncontrolled document"
depending on certain processes at our company.

I thought the best way to solve this is to tag the sentences in a snippet in the master page and use snippet conditions at file level of the topic to control which sentence is displayed.

Maybe an "illustration" will show what I mean:

my_tags
tag_a
tag_b

my_snippet
tag_a.sentence_A
tag_b.sentence_B

my_master_page
my_snippet

my_topic
my_snippet

my_topic file properties
snippet condition:
include Tag_A
exclude Tag_B


I was hoping for this result:

"Sentence_A"

but the result is:

"Sentence_A"
"Sentence_B"

Both sentences are printed. I suspect this is because the snippet condition is applied to the file (topic) content, but not to the snippet in the topic since it's source is the master page. Does that make sense?

So now here is where I hit a dead end.

How do I control, topic by topic, which of the two sentences is displayed, using tags at file level?

Thank you for your help any/everyone.

John
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: tags in snippets in master pages, control at file level

Post by LTinker68 »

If you want the appropriate block of text to appear in both online and print outputs, then the best option is to create two snippet files (one for each text option) then insert the appropriate snippet into each topic.

Conditions control what content is included in the output at the time it's built, not the content the user sees in real-time. Once the output is built, you won't find any tags or attributes in the output that relate to conditions.
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
john
Jr. Propeller Head
Posts: 9
Joined: Fri May 03, 2013 5:50 am

Re: tags in snippets in master pages, control at file level

Post by john »

Hi Lisa,

Thank you very much for your response. Your method definitely works, however, it means that I would have to add the snippets to every topic. I am at a loss because as the document grows, it will become "extremely inefficient". If I had to add an additional alternative text, I would have to add a snippet to every topic in the project.

I am trying to get around that by having a "tagged" snippets the master page (in order to avoid having to place snippets in every topic). I was then trying to control which of the snippets (which are part of the master page) show, by using the "snippet conditions" property in the relevant topic.

I am aware that for on-line outputs, I have the option to create additional master pages using styles. However, because I am using both on-line and print outputs this won't work (because I have to use layout pages as well).

I thought the "snippet conditions" concept was a good approach, but was probably mistaken.

Thanks for your help.

John
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: tags in snippets in master pages, control at file level

Post by LTinker68 »

john wrote:I thought the "snippet conditions" concept was a good approach, but was probably mistaken.
It is a good approach if you're trying to control what's included in the output. As in, show this paragraph in TargetA and show that paragraph in TargetB. Conditions in Flare aren't designed for run-time conditioning. That is, you can't show this paragraph when looking at TopicB and show that paragraph when showing TopicC, if both those topics are in TargetA's output. To do something like that, you'd need to add your own JavaScript that shows or hides blocks of text using IDs and some other run-time evaluations. And hidden doesn't mean removed, so those hidden blocks of text would still be returned in search results, but if the user followed that search result, the JavaScript may result in the user not seeing the content, which could be confusing.

Long story short, what you want to do is probably possible, but not natively in Flare -- you'd have to implement your own code to get the functionality you want.

Although snippets would be more onerous to implement on your part initially, it would lead to the best results for the end user. Unless you expect to have to swap around snippets every time you make changes to the project, in which case, that may not be feasible. So is it just onerous once (initial implementation) or would it be repetitively onerous (every time you release your project)?
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
NorthEast
Master Propellus Maximus
Posts: 6363
Joined: Mon Mar 05, 2007 8:33 am

Re: tags in snippets in master pages, control at file level

Post by NorthEast »

I'd suggest putting in a bug report - the snippet condition is only being applied to snippets in the topic body, but not snippets in the master page.
john
Jr. Propeller Head
Posts: 9
Joined: Fri May 03, 2013 5:50 am

Re: tags in snippets in master pages, control at file level

Post by john »

Hi Dave and Lisa,

Thank you for your inputs.

I understand your explanation Lisa, that conditions aren't targeted/designed for run-time. From Flare's help on "snippet conditions" however, it appeared to me that the following was explicitly possible: "show this paragraph in TopicB and show that paragraph in TopicC". Flare help clearly mentions the "masterpage" approach. Again, maybe i completely misinterpreted what was being said/written.

The project is just onerous, but an "additional" text may be required by the local authorities at some point in the future...making the "snippet in every topic" approach problematic. What does present another problem is that I would have to put the snippet (since I also have to publish to pdf) on every page in every topic...

Dave, thank you for your suggestion.

Cheers to both of you and thank you for your time.

John
john
Jr. Propeller Head
Posts: 9
Joined: Fri May 03, 2013 5:50 am

Re: tags in snippets in master pages, control at file level

Post by john »

Hi Dave and Lisa,

I put in a bug report. I received feedback from MadCap indicating that it is indeed a bug which they will have a look at.

Thanks for your time.

Cheers

John
lauraj
Propeller Head
Posts: 73
Joined: Tue May 09, 2006 3:35 pm
Location: Colorado

Re: tags in snippets in master pages, control at file level

Post by lauraj »

Are there any updates on this issue?

I've been trying to do something similar to the original poster, for a different reason. In my case, I have a master page for my help file (CHM output), to which I've added a link to the introduction topic. (The problem I'm trying to solve is that, because most users will enter the help system through CSH, they may miss important info that is in the intro.)

This works fine except for the intro topic itself. Obviously I don't want it linking to itself (looks broken). I thought that by putting the link in a snippet and applying a snippet condition, excluded only in the intro topic, I could get the result I wanted -- but no. It appears that Flare applies the snippet conditions that are defined in the properties of the master page itself, which doesn't help me at all. :(
- Laura
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: tags in snippets in master pages, control at file level

Post by LTinker68 »

lauraj wrote:This works fine except for the intro topic itself. Obviously I don't want it linking to itself (looks broken).
For this situation, I'd create a second masterpage that didn't include the link, then apply that masterpage just to that intro topic. I actually have three masterpages in my projects -- the default one used for most all topics (includes a breadcrumb trail), a top-level masterpage that's used by my "chapter" topics that has a mocked up breadcrumb with just a "Home" link, and the masterpage used by the intro topic (no breadcrumb, but space still reserved so there's no visual vertical jump when going from the intro to another topic).

See this KB article for how to use multiple masterpages in your project -> http://kb.madcapsoftware.com/Default_CSH.htm#FMP1001F
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
lauraj
Propeller Head
Posts: 73
Joined: Tue May 09, 2006 3:35 pm
Location: Colorado

Re: tags in snippets in master pages, control at file level

Post by lauraj »

THANK YOU! Yes, that's what I need. I actually tried that approach too, but couldn't figure out how to do it and concluded it couldn't be done. :oops:

This is a great user forum. :) Thanks again.
- Laura
lauraj
Propeller Head
Posts: 73
Joined: Tue May 09, 2006 3:35 pm
Location: Colorado

Re: tags in snippets in master pages, control at file level

Post by lauraj »

YIKES...

This approach worked for me, BUT I had to do the EDITING of the stylesheet in Flare 9, NOT in Flare 10. When I did the editing in Flare 10, then tried to build the CHM file, I got the infamous "Object Reference Not Set to Instance of an Object."

After editing the .css in Flare 9, I can build in Flare 10. When I look at the .css, the relevant section looks like this:

html.welcome
{
mc-master-page: url('../Resources/MasterPages/WelcomeMaster.flmsp');
}

html
{
mc-master-page: url('../Resources/MasterPages/Master.flmsp');
}


So if you are trying to do this, and don't have Flare 9, you could presumably get away with hand-editing your .css using this syntax. :) But I'll submit this as a bug to Flare & they'll probably fix it fairly quickly.
- Laura
Post Reply