2. Existing Functionality in Site Manager 7.3
• Page Layouts (Styles) & Content Layouts
(Template Formatters)
• Made up of HTML with T4 Tags in them
• On preview / publish, T4 Tags are parsed and
Brokers, written in Java are called to process
them
Programmable Layouts 2
3. Shortcomings of placeholders
• Using token replacement is restrictive
• No if / then / else logic
Programmable Layouts
• Can be applied to Page and Content Layouts
• Initially implemented Javascript (Rhino)
• Scope to extend to other scripting languages
• Allow Layouts to be programmed
• Turing Complete
Programmable Layouts 3
4. Programmable Layouts
• All functionality in current Layouts available in
Programmable Layouts
document.write (BrokerUtils.processT4Tags (oStmt, oCache, oSection,
oContent, sLang, fPreview, sTextToParse));
• Process T4 Tags within the provided page and
output the result to the current page
• Using document.write writes text to the
current page
Programmable Layouts 4
5. Programmable Layouts
• Simple if / then / else logic
if (BrokerUtils.isFullTextPage (oCache)) {
document.write ('<p>This is a full text page</p>');
}
if (sLang === 'es') {
document.write ('<p>We're on the Spanish page.</p>');
}
else {
document.write ('<p>We're NOT on the Spanish page.</p>');
}
Programmable Layouts 5
7. Programmable Layouts
• More Complex functionality possible
• Prototype queries an external database &
outputs the results in a HTML table within the
published page
• This has been done with less than 100 lines of
code within the Layout
Programmable Layouts 7
8. Benefits of Programmable Layouts
• Applicable to Page and Content Layouts
• Makes it simple to create complex pages
• Hugely powerful
• Provide simple if / then / else logic
• Access to entire TERMINALFOUR API
• Can access external database
• Can read external web services
Programmable Layouts 8
9. • Will be available in Beta form in Site Manager
7.4
• Can be enabled on a per-Layout basis to ensure
backwards-compatibility and performance
• Security…
Programmable Layouts 9