Attribute Scripting Syntax
Return to Attribute Scripting
The following syntax rules apply to attribute scripts and layout commands:
- Attribute scripts must be within an attribute named "editme".
- There can only be one editme attribute in a tag, and attributes cannot appear in closing tags.
- Commands may accept one or more arguments separated by a space.
- The last Layout command argument may accept JavaScript code.
- Multiple Layout Commands are separated by two semi-colons (;;).
- Though the editme attribute is removed when the script is processed, the tag is left behind. Use the SS Self-Removing Tag when you don't want to output the containing tag.
Examples of correct syntax:
- Layout command with no arguments:
<span editme="parse">Hello, {user.name}!</span> - Single JavaScript argument:
<p editme="text 'hello!'">will replace this text with hello!</p> - Single JavaScript argument containing multiple JavaScript statements:
<span editme="text s=page.title; s.length>0 ? s : page.name">will replace this with the page title or page name if title is blank</span> - Multiple commands in a single attribute:
<div editme="if user.isLoggedIn ;; text user.name">will replace this with user name if user is logged in</div>
Examples of incorrect syntax:
- Attribute name must be editme:
<p script="parse">Hello {user.name}!</p> - Cannot have multiple editme attributes per tag:
<p editme="if user.isLoggedIn" editme="parse">Hello {user.name}!</p> - Cannot put attributes in closing tag:
<p>Won't work</p editme="parse"> - Double semi-colons must be sequential:
<p editme="if user.isLoggedIn ; ; parse">Hello {user.name}!</p>