Advanced Placeholder Example

In this example, a list of css includes is maintained that can be appended to during the page lifecycle. This technique is extensivley used in Smartsite to get access to head section data fromĀ item business logic.

Smartsite SXML CopyCode image Copy Code
<se:placeholder id="css_includes" 
    ignoreduplicates="true" 
    sortcolumn="priority desc"
    rowdelimiter="{char.crlf()}">
    <se:parameters>
        <se:parameter name="fieldnames">
            <se:collection>
                <se:member name="url" type="locator" primarykey="true"></se:member>
                <se:member name="priority" type="integer"></se:member>
            </se:collection>
        </se:parameter>
        <se:parameter name="rowformat" whitespace="remove">
            <link rel="stylesheet" type="text/css" href="{this.field(url)}" />
        </se:parameter>
    </se:parameters>
</se:placeholder>        

{placeholder.add(css_includes, '/css/test.css')}
{placeholder.add(css_includes, 'mycss')}
{placeholder.add(css_includes, 'mycss')}
Example Result CopyCode image Copy Code
<link rel="stylesheet" type="text/css" href="/css/test.css" />
<link rel="stylesheet" type="text/css" href="/test.net?id=mycss" />