Attribute Scripting

Search:

Welcome

Login to contribute. Register if you haven't yet.

Need Support?

Search this site to find an answer. If you still need help, post a Question. Private or account-related support inquiries can be made at the Private Support forum.

Attribute Scripting Syntax

Return to Developer Support 

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. 
  • Layout 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 (;;). 

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>