Define Entity

Define a global entity
define-entity name () documentation-string {form}*

Defines a new entity referenced by the name and installs it for the current site. The definition replaces any previous global definition of the entity.

The new entity will be listed in the Entities dialog of the current site together with documentation taken from the definition. The entity can be referenced in any content of the site using an entity reference such as &name; where the name equals the label from the entity definition.

The body of the definition typically contains one or more forms, where the result of the last form provides the value of the entity. Other variations are also supported. If the body is an entity reference such as &interaction; the result will be an alias entity. If the body is a string, the result will be a text entity with the given value as default. If the body is a marked section, the entity will provide the markup.

Side effects: Changes or establishes the global entity definition for the symbol 'name' as an entity.

(define-entity random-number ()
  "A random number from 0 to 9"
 (random 10))

(define-entity software ()
 "An alias to the link for Interaction"
 &interaction; )

(define-entity slogan ()
 "Our favorite slogan"
 "Makes your website a dynamic social place that adapts to the visitor!" )

(define-entity markup ()
 "Example of a markup entity"
 <![[ <A HREF="http://www.in-progress.com">This is a link</A> ]]> )

Related: define-entity-value

Interaction Developer Reference


This site is enhanced with Interaction.