Simple ViewSource Example

This example shows how to display SXML source code as (escaped) HTML.

Smartsite SXML CopyCode image Copy Code
<se:viewsource>
    <se:if expression="user.isanonymous()">
        <se:then>
            {html.link(login_page, 'Please log in')}
        </se:then>
        <se:else>
            Welcome, {user.fullname()}
        </se:else>
    </se:if>
</se:viewsource>
Example Result CopyCode image Copy Code
<pre>
    &lt;se:if expression="user.isanonymous()"&gt;
        &lt;se:then&gt;
            &#123;html.link(login_page, 'Please log in')}
        &lt;/se:then&gt;
        &lt;se:else&gt;
            Welcome, &#123;user.fullname()}
        &lt;/se:else&gt;
    &lt;/se:if&gt;
</pre>