PlaceholderData Example

The placeholderdata macro provides a way to pass XML data to a given placeholder. It can be used instead of Viper methods such as placeholder.add(), especially when passing literal data containing markup.

Smartsite SXML CopyCode image Copy Code
<se:placeholder id="data">
    <se:parameters>
        <se:parameter name="fieldnames">
            <se:collection>
                <se:member name="nr" primarykey="true" type="integer"/>
                <se:member name="name"/>
            </se:collection>
        </se:parameter>
        <se:parameter name="rowformat" whitespace="remove">
            <li>{this.field(name)} <sup>({this.field(nr)})</sup></li>
        </se:parameter>
        <se:parameter name="resultformat" whitespace="remove">
            <ul>{this.result()}</ul>
        </se:parameter>
    </se:parameters>
</se:placeholder>
<se:hidden>
    <se:placeholderdata targetid="data">
        <se:collection>
            <se:member name="nr">1</se:member>
            <se:member name="name">Hello</se:member>
        </se:collection>
    </se:placeholderdata>

    <se:placeholderdata targetid="data">
        <se:collection>
            <se:member name="nr">2</se:member>
            <se:member name="name">Bye</se:member>
        </se:collection>
    </se:placeholderdata>
</se:hidden>
Example Result CopyCode image Copy Code
<ul><li>Hello<sup>(1)</sup></li><li>Bye<sup>(2)</sup></li></ul>