If you've used PHP or ASP you might like to read this first!. A more complete introduction
to Whitebeam applications is also available. This page is intended for experienced server-side application engineers. It is short and concise - providing
hopefully just the information you need. A more detailed introduction is available.
You will need to have downloaded and installed
Whitebeam before starting. Whitebeam provides a complete server-side application development environment. Programs are stored text files
that, by convention, are given the extension 'whtm' or 'rhtm'. You can of course use any extension provided
you configure Apache appropriately. File ContentsThe files are similar to ASP or PHP pages if you're familiar with other server-side scripting environments, with
the exception that the files contain valid XML, and the server parses the files to ensure this is the case.
Most other environments Whitebeam is based around an XML model - as opposed to a flat text file on which
text substitions are performed. Embedded ScriptThe text files that form a Whitebeam application are superficially similar to a PHP or ASP page. The file contains
markup and embedded server-executed script. In the case of Whitebeam - the server-side scripting language is
the industry standard 'JavaScript'. There are a number of ways of representing JavaScript within a Whitebeam: XML Tag | Processing Instruction |
---|
<rb:script> javascript </rb:script> | <?rbscript javascript ?> |
There are also a couple of abbreviated forms. XML Tag | Processing Instruction |
---|
<rb:eval expr="javascript"/> | <?= javascript?> |
And a way of 'calculating' the value for an XML attribute <sometag rb:eval="label#javascript"> In this latter case the JavaScript expression is evaluated and the rb:eval tag is completely
replaced by a new attribute. The name of the attribute being label and the value being the
result of evaluating the JavaScript expression. eg <td rb:eval="class#className"> Whitebeam is an XML applicationAlthough Whitebeam provides a server-side implementation of JavaScript as a scripting language, in
itself this is not particularly different to other server-side scripting environements. What puts
Whitebeam ahead of other systems is it's extensive use of XML. Whitebeam is an XML application, the
files that form an application are structured XML and the Whitebeam uses that information extensively, By understanding XML the Whitebeam engine allows application engineers to manipulate that structure. One of the
most powerful examples of this is the ability to attach behaviour to new XML tags. For example - consider a
simple menu system, similar to the one used on this site. The menu has a tree structure and can be ideally
represented in XML. Whitebeam allows you to create a new tag, for example 'menuitem'. You can then attach
JavaScript code to that tag so that each time the Presentation Engine sees that tag it executes the associated
code. That code can do anything. For example it can decide wether the URL in the item matches the current URL, and
if it does then to show the item using a different style. This can be thought of as being similar to an XML stylesheet - but infintely more powerful. Not only can you change
the look and feel - you could go and access a database, replacing the tag with stored content for example.
Apart from the power - Whitebeam allows you to specify this behaviour using a familiar procedural langauge
rather than a new declarative language such as XSLT. Predefined 'Whitebeam' tagsWhitebeam implements a number of new XML tags itself that you can
embed in your application pages to control your application. Although everything *can* be done in JavaScript -
this doesn't really use the power of the system. Load a page full of script into DreamWeaver or and XML editor
and you don't get very much help - the structure of the page is not visibile. By using the Whitebeam XML tags - you can write an application and have the appearance of that application
work within existing XML editors. The Whitebeam tags allow you to control which parts of a document should
be shown under what circumstances, cause a block of XML to be repeated a number of times, for example once for each
row in an HTML table. |