The Smartlet (SML) Content Type

Release 1.1 - ...

A new system ContentType, Smartlet (SML) is introduced for the Smartlet Architecture.

Smartlet items have all the characteristics of a 'normal' translation:

  • They can be global and local
  • They can be overridden locally if set to 'overridable'
  • They can be called as functions with named and unnamed arguments using the Viper syntax.

One thing that is unique to Smartlet ContentType however is the fact that items of this ContentType can be requested directly from the browser. For this, SML must be mapped to any channel it is used in. However, only requests using JSON over AJAX (XmlHttpRequest - XHR), and only direct callbacks from items that contain a call to the given Smartlet, will be accepted. In all other cases, a security exception will be thrown.

CTFPs

Smartlet Translations will always host an instance of the <se:smartlet /> macro. This macro defines the public interface of Smartlet state traveling between client and server, whether as post data, url querystring parameters or as JSON state. This interface is static as long as the SML items is not modified so it can be persisted for quicker access over multiple calls. This persistence is achieved by introducing a new feature in Translations: a .NET object deriving from the TranslationVersionState class can be linked to each Translation Version at runtime. For this to work, the StateType ContentType CTFP (set on the Nr ContentType Field) is introduced. For the SML ContentType, its value should be set to:

  CopyCode image Copy Code
Smartsite.Scf.SmartletState, Smartsite.Scf