9.1 Look and Feel Functions | |
Applications often have a common look and feel associated with every page, with certain HTML at the top and bottom to set background color, give links, etc. By placing this code in a pair of functions such as <look> and </look> , we can maintain the application-wide look and feel in one place:
<SCRIPT LANGUAGE=vortex> <A NAME=look title=""> <IF $title neq ""> <HEAD><TITLE>$title</TITLE></HEAD> </IF> <BODY BGCOLOR=white> </A> <A NAME=/look> <P><HR><A HREF=$url>Main page</A> </BODY> </A> <A NAME=main PUBLIC> <look title="Welcome"> Welcome to Yoyodyne Propulsion Systems, Inc. ... </look> </A> </SCRIPT> |
Here we use our <look> and </look> functions in <main> to simplify the generation of the entry page: it's logically contained within the look "block" tags. All other pages would use the look function similarly.
Since it's called at the top of every page, the <look> function is also a good place to do security checking, such as disallowing non-trusted remote hosts, etc.
Our patent search example, which we'll see shortly, uses look-and-feel functions this way.
Back: Common Tasks in Vortex | Next: Embedding Javascript |