PDA

View Full Version : Mysteries of the <span> tag revealed


Dan Korn
April 8th, 2009, 08:37 AM
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.

Brian F.
April 9th, 2009, 01:33 PM
Where are the places one could use the tag? Product templates? Custom P1 Copy in store options? Product descriptions or instructions?

mhilger
April 10th, 2009, 06:25 AM
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.

Dan Korn
April 10th, 2009, 06:50 AM
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 (http://forums.printable.com/forumdisplay.php?f=23) > Formatting Text (http://forums.printable.com/forumdisplay.php?f=32)". Although technically one can use tagged markup such as this in input and resource files without JavaScript rules.

AndyShaw
July 17th, 2009, 09:31 AM
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 --

Dan Korn
July 23rd, 2009, 03:42 PM
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";