snippets & conditions

This forum is for all Flare related Tips and Tricks.
Have a tip or trick you use while working in Flare? Share it here.
Post Reply
MC Hammer
Sr. Propeller Head
Posts: 225
Joined: Wed Aug 08, 2007 3:04 am
Location: In a galaxy far, far away

snippets & conditions

Post by MC Hammer »

Hello everyone
I am working on a project with 6 different targets (all HTML Help), depending on the software incarnation. Some functionality and screenshots are generic but each product has got its own specificities. Some topics are common to all 6 products but some require some conditions in parts of them (I have applied some conditions at content level), and some are only valid for a product (I have applied conditions at topic level).
I have one paragraph that is present in most topics. I have created a snippet for it. The snippet itself has conditional text as if most of the content is common, some terms only apply to a specific software incarnation.
This does not seem to work, i.e. the snippet conditions (I have not applied any conditions to the snippet file itself as it is used in the 6 help files) do not seem to be applied in the way I was expected them to. Within the snippet, the words to which "Incarnation A" condition has been applied to do not appear in the output for incarnation A. It looks like any conditional text within my snippet is not shown for any incarnation.
Am I doing things right or do I need to create 6 snippets, one for each software incarnation without any conditions at text level, but a condition at snippet level?

Thanks in advance for your help.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: snippets & conditions

Post by i-tietz »

I suppose, you have set the appropriate snippet condition in the topics that you insert the snippet into?
MC Hammer
Sr. Propeller Head
Posts: 225
Joined: Wed Aug 08, 2007 3:04 am
Location: In a galaxy far, far away

Re: snippets & conditions

Post by MC Hammer »

I have but I have an issue for common topics. Let's say I have topic X which is valid for all the software incarnations (A to F).
By going to Properties on that topic and by opening the Snippet Conditions tab, I have clicked on all my snippet conditions : snippet.A to snippet.F as the topic is common. Then, on the target conditional text for software incarnation A (Target > HTML Help incarnation A), I have only included snippet.A and have excluded conditions snippet.B to snippet.F. So theoretically, when I build the target for A, I should only see conditional text snippet.A for topic X, which I do not (I can see all of the snippet conditions)...
Is this normal?
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: snippets & conditions

Post by KevinDAmery »

I think what I would do is remove the snippet condition selections from the topic (i.e. no includes or excludes). Control the includes and excludes in the output target only.

I think what is happening is the include you have for all conditions at the topic level is over-riding the excludes at the target level. (This makes some sense, for two reasons: 1) afaik includes always over-ride excludes, and 2) it follows the CSS principle that parameters that are closer to the text take precedence over parameters that are higher in the cascade.)
Until next time....
Image
Kevin Amery
Certified MAD for Flare
MC Hammer
Sr. Propeller Head
Posts: 225
Joined: Wed Aug 08, 2007 3:04 am
Location: In a galaxy far, far away

Re: snippets & conditions

Post by MC Hammer »

Hi Kevin
Thanks for your help. Your suggestion seems to work, except for two topics which no matter what I do to do (I have removed all the includes and excludes at topic level, then re-inserted the snippet and made sure the snippet conditions were set up to the correct incarnation of the software at output level) are displaying the snippet with all the conditional text and not just the one I wanted...
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
KevinDAmery
Propellus Maximus
Posts: 1985
Joined: Tue Jan 23, 2007 8:18 am
Location: Darn, I knew I was around here somewhere...

Re: snippets & conditions

Post by KevinDAmery »

If it's just happening with the two topics, I would suspect something is weird with those topic files. I can see two ways to get out of it:

1) Open a topic that works and one of the problem topics in the internal text editor (or another text editor of your choice). Check the code to see if there's anything different about them.

OR

2) Create new topics and copy the text from the problem topics into the new ones.

Number two is probably the faster method.
Until next time....
Image
Kevin Amery
Certified MAD for Flare
MC Hammer
Sr. Propeller Head
Posts: 225
Joined: Wed Aug 08, 2007 3:04 am
Location: In a galaxy far, far away

Re: snippets & conditions

Post by MC Hammer »

Hi Kevin
Thanks for your suggestions. As a matter of fact, I have compared files in my text editor and there isn't anything obvious. I will probably have to implement your solution n.2.
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: snippets & conditions

Post by i-tietz »

Those topics with the problem - are they in a folder that has conditions assigned?
MC Hammer
Sr. Propeller Head
Posts: 225
Joined: Wed Aug 08, 2007 3:04 am
Location: In a galaxy far, far away

Re: snippets & conditions

Post by MC Hammer »

Hi there
No, these topics are in the same folder as the ones for which the snippet conditions are working. The XML is very similar in the topics that are working and in the ones with the issue. I have created new topics and some of them are exhibiting the same problem. I really do not understand what is going on...
Whenever I get a chance, I will have to investigate this, and may have to resort to Kevin's solution.
DoCo
Propeller Head
Posts: 47
Joined: Tue May 26, 2009 3:18 am
Location: Belgium

Re: snippets & conditions

Post by DoCo »

It is quite an old thread, but I wonder if you eventually solve your trouble - at least if you find out what was wrong with the 2 recalcitrant topics.
I also use snippets with conditional tags to display the specific product incarnation depending on the selected target. These snippets used to work perfectly well, except in 1 single topic. I run a battery of (blind) tests and finally identified what was - and still - causing the trouble : tables. As long as my topic only contains 1 single table, the snippet works exactly as expected and only displays the selected incarnation. As soon as I introduce a second table, the snippet freaks out and displays all the incarnations, whatever the target.
Maybe if you still have the 2 problematic topics at disposal, you could check if they contain more than one tables too... That would not solve the problem but will maybe help understanding it !
Anyway, if you could suggest a solution, I would be glad to hear about it !
Thank's in advance,

DoCo
doc_guy
Propellus Maximus
Posts: 1979
Joined: Tue Nov 28, 2006 11:18 am
Location: Crossroads of the West
Contact:

Re: snippets & conditions

Post by doc_guy »

DoCo,

Welcome to the forums. This sounds like an issue that MadCap Support would want to know about, especially if you can replicate it in multiple projects. You should start by logging a bug here: https://www.madcapsoftware.com/bugs/submit.aspx
Paul Pehrson
My Blog

Image
DoCo
Propeller Head
Posts: 47
Joined: Tue May 26, 2009 3:18 am
Location: Belgium

Re: snippets & conditions

Post by DoCo »

Done !
I hope it will lead to a happy end...
Anyway, thanks for the welcoming ! I have been reading this forum for quite a long time and I found here many helpful tips... Maybe one day I will be able to post useful tips myself in return !

DoCo
DoCo
Propeller Head
Posts: 47
Joined: Tue May 26, 2009 3:18 am
Location: Belgium

Re: snippets & conditions

Post by DoCo »

Hi,

The Support informed me that was fixed in Flare V4.
I have just upgraded from 3.1 to 4.2 and tried out: indeed, no more trouble with conditional Tag in Snippets in multi-tables Topic.

Happy end !(assuming adopting Flare V4)

DoCo
MC Hammer
Sr. Propeller Head
Posts: 225
Joined: Wed Aug 08, 2007 3:04 am
Location: In a galaxy far, far away

Re: snippets & conditions

Post by MC Hammer »

DoCo wrote: Anyway, if you could suggest a solution, I would be glad to hear about it !
DoCo
Hi there
Sorry, have not been browsing the forums lately. My workaround to this was to create 6 different snippets so I had no conditions on these for the problematic topics. These topics do not have tables. I now use Flare v4 but am still using my different snippets as they work fine. Sorry not to be of more help.
Marie-Claire
Flare 2019 r2 - Windows 10 Pro - HTML5 help / "clean" XHTML output
Post Reply