Definition of Whitebeam XML Tags

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
    authenticate
    block
    cachecontrol
    eval
    false
    header
    include
    insertblock
    insertdebug
    macrotag
    marksession
    nomacro
    noscript
    parser
    redirect
    repeatfor
    return
    script
    if
    test
    true
    xmp
    eval
    id
    marksession
    test
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Definition of Whitebeam XML Tags

rb:eval

This attribute behaves in a very similar way to the <rb:eval...> tag. The 'value' part of the attribute is a JavaScript expression that is evaluated by the presentation engine. The result of the evaluation is then substituted for the attribute. The syntax for the expression has one modification over the tag variant. The syntax can be summarised as:

'[new attribute name#]JavaScript Expression'

The 'new attribute name' is optional. If present it is followed by a '#' delimiter and then the JavaScript expression. There are two cases to consider: name present; name absent.

Name Present

If the name is present then the entire 'rb:eval' attribute is replaced with name=expression_result. That is the JavaScript expression is evaluated and the result used as the value part of the replacement attribute. The name is taken from the string before the '#'.

Example

<a rb:eval="href#session.homepage()">Home Page</A>

...assuming 'session.homepage()' returns 'petespage.htm' the Presentation Engine will translate this tag into:

<a href="petespage.htm">Home Page</A>

Note: The Presentation Engine wraps the value returned from the JavaScript expression in double quotes. There is no need for the expression itself to do this, however if the expression can itself contain quotes then it should be escaped using the JavaScript 'escape' method.

Name Missing

If the name is not specified in the expression string the Presentation Engine simply evaluates the JavaScript expression and uses the results as the raw replacement for the tag. It is the responsibility of the script to generate all the elements of the replacement attribute

Example

<a rb:eval="'href=&quot;'+session.homepage()+'&quot;'">
Home Page</A>

...assuming 'session.homepage()' returns 'petespage.htm' the Presentation Engine will translate this tag into:

<a href="petespage.htm">Home Page</A>

In this case the expression needs to include double quotes, these can be included using the &quot; sequence. The Presentation Engine 'unescapes' the string provided before giving the string the JavaScript engine. Note also how double and single quotes are used to generate the URL.

Whitebeam release 1.3.36
(loadtime : 9ms)