Basic Scripting
From Build 2.0.1.238, Iosphere 2 supports an 'If..Then..Else' command. This is of the following form:
Single-line If-Then-Else
If(arg1 compare arg2) Then (do_this) Else (do_this)
arg1, arg2 and do_this can either be a property (eg Document.Title) or a literal string, surrounded by double quotes ("").
compare can be either = (is equal to) or != (is not equal to).
For example:
%%If(Document.Title = "") Then ("[Untitled]") Else (Document.Title)%%
The above line will insert the title of the document if it has one, otherwise it will insert [Untitled].
Multi-line If-Then-Else
As of version 2.0.1.608, Iosphere supports a new, more powerful If-Then-Else
statement. This functions more like other scripting languages. The example
above can be re-written like:
%%
If(Document.Title = "") Then
[Untitled]
Else
Document.Title
End If
%%
This comes in useful when you only want to display information about
an author if an author is actually set up:
%%If(Document.Author != "") Then%%
<p>By %%Document.Author%%
</p>
%%No Else%%
%%End If%%
Any pages which don't have the "Author" property set won't display
"By [author]". Note: If you don't have an "Else" statement, you
must include the words "No Else".
|