Skip to main content
Inspiring
April 24, 2008
Answered

variable information in a snippet

  • April 24, 2008
  • 16 replies
  • 3733 views
I'm not sure I fully "get" the concept behind the new snippet functionality in RH7. I understand the part about how they are reusable blocks of text that you can create once and insert in many places. That makes sense, but I rarely include *exactly* the same block of text in multiple places. What I do, though, is to include very similar instructions in many places. The steps vary slightly depending on the topic. That is, the topic called "Creating X" includes numbered steps for setting up X; the topic called "Creating Y" includes numbered steps for setting up Y; and the topic called "Creating Z" includes numbered steps for setting up Z. Except for the names of what's being created (X vs Y vs Z), the step-by-step instructions are the same.

I was hoping to use a snippet for the text in topics X, Y, Z that is identical (most of it), while somehow inserting a variable in the snippet that would change from X to Y to Z, depending on the topic. Can that be done?



    This topic has been closed for replies.
    Correct answer Peter Grainge
    That is what I envisage.

    16 replies

    Peter Grainge
    Community Expert
    Community Expert
    April 25, 2008
    Don't we have enough trouble with cascading style sheet, embedded style sheet and inline style conflicts? Snippets within snippets looks like it has the same potential! :-)

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Captiv8r
    Legend
    April 25, 2008
    ROTFLMAO!!!!

    Hmmm, snippet within a snippet. Don't think I've tried that one. I wonder if it would work... Hmmmm Must.... fight.... resist... urge.... to... play.... wife.... calling... meet for.... coffee... aaaaaaargggghhhhh!

    No, I was thinking of a LOTR snippet. Maybe we call them Gollum's. One snippet to rule them all. Bwa ha ha ha haaaaa
    Peter Grainge
    Community Expert
    Community Expert
    April 25, 2008
    Leon

    The snippet would contain Value 1 and Value 2, both with different conditions. I think that is what you are suggesting in the way that before variables you would then create a build expression that used one of those values.

    You can apply a tag to the snippet but come build time you would get just one of those values from the snippet and that would then cascade into all the topics. Think of the snippet as a topic, the content is either in or out. You cannot create a build expression that looks at where the snippet is being used.

    The whole idea of snippets is "this is what I want **everywhere** it is used, not "sometimes I want this and sometimes I want that". That is two snippets. Somewhere the snippets, or the variables within, or the tags within, would need to be mapped to topics so that RH would know where to apply the differences.

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Captiv8r
    Legend
    April 25, 2008
    Hi all

    I think if Adobe were to change the way snippets worked, it could be made to happen as Kathy wants. As I see it, she is wanting *Most* of a snippet to remain the same and some variable text here and there. That much can clearly be accomplished today using a combination of multiple snippets with multiple variables. She would have to duplicate a particular snippet and add variables as required.

    Here comes the kicker. If I'm understanding correctly, she would love to see the ability to have something along the lines of a "Master" snippet. So you would define the master with the boilerplate text. Then create duplicates based off the master. Insert either static text or a variable for the "different" information. (I'm not seeing why a variable would really help here). Because these "other" types of snippets are based on the master, all you would need to do is to change the master verbiage to update any copies based off it. So in this fictitious world where everything would be ponies that ate nothing but rainbows and pooped butterflies, this would provide exactly what was needed, no?

    For what it's worth, I think some of what Peter covers in Terminology on his site may assist in this case.

    Just thinking out loud... Rick
    Peter Grainge
    Community Expert
    Community Expert
    April 25, 2008
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

    is the answer to your question but I don't see how what you want can be done.

    Once the content of a snippet, be it part of the text or a variable, is different, then you are not using the same snippet.

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    MergeThis
    Inspiring
    April 25, 2008
    Why can't your snippet contain conditional tags? Have you tried that? I'm still on RH X502, so I can't test it myself.


    Good luck,
    Leon
    kmaddox1Author
    Inspiring
    April 24, 2008
    Thanks, Peter. That's what was slowly dawning on me. Unfortunately that makes snippets a lot less useful than I'd like (since I almost never use *exactly* the same block of text in multiple places). Instead, I very, very consistently use the same basic structure in many places, varying only a keyword word or two between topics). I'd like to request that Adobe look into supporting this functionality for the next release. What's the process for doing that?
    Peter Grainge
    Community Expert
    Community Expert
    April 24, 2008
    A snippet has to be the same in all topics. It follows therefore that the variable can only have one value.

    Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Captiv8r
    Legend
    April 24, 2008
    Hi Kathy

    Seems to allow adding a User Defined Variable in a snippet with no issues. Just edit the snippet, then create or assign the User Defined Variable where you want.

    Cheers... Rick
    kmaddox1Author
    Inspiring
    April 24, 2008
    Thanks, Rick. Yes, I can insert a user-defined variable in a snippet, which works fine. So I guess my question really has to do with the use of user-defined variables. Specifically, how do I change the definition of a variable used in a snippet, based on where the snippet is used?

    For example, I created a variable called "parameter" and used it a several places in my "General instructions for parameters" snippet. I then defined this variable to mean "Auto Search," which works great for the topic that provides instructions for creating a parameter called Auto Search. But I also want to use the same snippet in another topic that provides instructions for creating a parameter called Relationship. That is, I want my "parameter" variable to mean either "Relationship" or "Auto Search" (or other things), depending on which topic the snippet is used in. The instructions in RH aren't clear on how (or if) you can do that.