Dan Korn Posted April 8, 2009 Share Posted April 8, 2009 (edited) The <span> tag is a powerful feature of the FusionPro VDP products suite. Unfortunately, it's currently undocumented. This post attempts to remedy that shortcoming. The <span> tag pair was designed to allow style overrides over a specific range, or span, of text. The initial, or opening, <span> tag can take several attributes, which specify style attributes to be overridden in the span. The overrides remain in effect until the ending, or closing, </span> tag is reached. The <span> tag can take any number of the following optional attributes: suppress={true|false}. Defaults to false. If true, all text within the span is suppressed.accumulate={true|false}. Defaults to false. If false, the ending </span> tag restores the style in effect at the beginning of the span. If true, the ending </span> tag restores the style, taking into account any other changes within the span.color=(color name). If present, the specified named color is applied to the entire span as an override.shading=(percentage) If present, the specified shading, or tint, percentage is applied to the entire span as an override. All colors applied to text within the span are shaded by the specified percentage.pointsize=(number). If present, the specified point size is applied to the entire span as an override. Units are in points.font=(font name). If present, the specified named font is applied to the entire span as an override.bold={true|false}. If present, the style of the entire span is set to either bold or not bold, as an override.italic={true|false}. If present, the style of the entire span is set to either italic or not italic, as an override. If the <span> tag is used without any attributes, it effectively acts as way to save the running text style and restore it when the ending </span> tag is reached. For example:<color name="Black">Hi <span><variable name="NameInColor"></span>, you're a winner!This ensures that the original running style of the text is restored, no matter what the "NameInColor" rule does, even if it changes the running color of the text using a <color> tag. Edited April 10, 2009 by mhilger Quote Link to comment Share on other sites More sharing options...
Brian F. Posted April 9, 2009 Share Posted April 9, 2009 Where are the places one could use the tag? Product templates? Custom P1 Copy in store options? Product descriptions or instructions? Quote Link to comment Share on other sites More sharing options...
mhilger Posted April 10, 2009 Share Posted April 10, 2009 Hello Brian, The <span> tag information that Dan is sharing here is specific to FusionPro VDP templates as opposed to FusionPro Web store display text. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted April 10, 2009 Author Share Posted April 10, 2009 The <span> tag information that Dan is sharing here is specific to FusionPro VDP templates as opposed to FusionPro Web store display text. Thus the location of this thread under "The JavaScript Library > Formatting Text". Although technically one can use tagged markup such as this in input and resource files without JavaScript rules. Quote Link to comment Share on other sites More sharing options...
AndyShaw Posted July 17, 2009 Share Posted July 17, 2009 Dan: Thanks for this info. It is very helpful for some things that we are working on right now. I do one follow-up question, though. I don't understand the explanation for the accumulate=true attribute. I'm not sure what you mean by "taking into account any other changes within the span." Can you provide a example to clarify? Thanks, -- andy -- Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted July 23, 2009 Author Share Posted July 23, 2009 I don't understand the explanation for the accumulate=true attribute. I'm not sure what you mean by "taking into account any other changes within the span." Can you provide a example to clarify? This example should illustrate the effect of the "accumulate" attribute: return "Accumulate off:<t><span color=Red>Hi<color name=Green> there!</span> After span<br>\n" + "Accumulate ON:<t><span color=Red accumulate=true>Hi<color name=Green> there!</span> After span"; Quote Link to comment Share on other sites More sharing options...
biggestbossfan Posted February 25, 2013 Share Posted February 25, 2013 Hi, I have a business card which includes name and qualification. If the qualification is not present, just the name will be shown. The name and qualification need to be indifferent colours. This appears to be a job for <span> I have the following: if (Field("Qualification 1").length < 0) return < color name ="pantone 335 C"><span> Field("First name") +" " +Field("Last name");</span> else return <color name = "pantone 335C"> <span> Field("First name") + " " + Field("Last name")</span>+ "\n" <color name = "grey"> <span>+Field("Qualification 1")+" " + Field("Qualification 2")</span>; Which clearly doesn't work. Any pointers would be gratefully accepted. Quote Link to comment Share on other sites More sharing options...
step Posted February 25, 2013 Share Posted February 25, 2013 Your syntax is a little off. You need quotes around your tags and you're missing a couple of plus signs. And if you want to simplify a few things, you can just use the color tags, you don't need the span tags as well: var result = '<color name ="pantone 335 C">' + Field("First name") + " " + Field("Last name") + '</color>'; result += (Field("Qualification 1") != "") ? '\n <color name = "grey">' + Field("Qualification 1") + " " + Field("Qualification 2") + '</color>' : ""; return result; Quote Link to comment Share on other sites More sharing options...
biggestbossfan Posted February 26, 2013 Share Posted February 26, 2013 Thanks for this. I think I'm missing something though. I get this returned: <color name ="pantone 335 C">Bruce Springsteen</color> <color name = "pantone 430 C">BSc Bcom</color> Quote Link to comment Share on other sites More sharing options...
step Posted February 26, 2013 Share Posted February 26, 2013 make sure you have "treat returned string as tagged text" checked. Quote Link to comment Share on other sites More sharing options...
biggestbossfan Posted February 26, 2013 Share Posted February 26, 2013 Aha - that works. Thanks Quote Link to comment Share on other sites More sharing options...
biggestbossfan Posted February 27, 2013 Share Posted February 27, 2013 This code yields the correct colours but doesn't insert a line break/feed. Could there be an issue with the \n? var result = '<color name ="pantone 335 C">' + Field("First name") + " " + Field("Last name") + '</color>'; result += (Field("Qualification 1") != "") ? '\n <color name = "pantone 430 C">' + Field("Qualification 1") + " " + Field("Qualification 2") + '</color>' : ""; return result; Quote Link to comment Share on other sites More sharing options...
step Posted February 27, 2013 Share Posted February 27, 2013 Try replacing the "\n" with "<br>" Quote Link to comment Share on other sites More sharing options...
biggestbossfan Posted February 28, 2013 Share Posted February 28, 2013 Thanks - perfect Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.