Thunderstone Software Document Retreival and Management
Search:
Advanced Search
Home | Products | Company | News | Tech Support | Demos | Contact Us
Vortex Manual

ENTRYFUNC, EXITFUNC - set entry/exit functions

   

SYNOPSIS

<ENTRYFUNC = function>
<EXITFUNC = function>


DESCRIPTION
The ENTRYFUNC directive sets an additional function to call first upon entry to the script, before the start function (which is specified in the URL or $cmd). By default, no entry function is called, ie. execution starts with the start function. The EXITFUNC directive sets an additional function to call when the script ends normally. By default no exit function is called.

Since execution of both functions is controlled by the script and not the user, private functions may be specified. As they are directives, both ENTRYFUNC and EXITFUNC must appear before the first function in the script,

An entry function can be useful for setting global variables, checking access permissions, or printing the look and feel HTML for an application. Since it is guaranteed to be called first gif - before the start function or main - it does not need to be explicitly called by every public function in the script, and will be called for any future public functions added. Once the entry function returns, execution resumes at the start function (or main) as normal. Thus, the entry function can concentrate on tasks that are the same for every invocation, while the specific start function(s) can deal with function-specific tasks (eg. displaying vs. editing). An entry function has advantages over EntryScript (p.  gif ) in that it can be used by any script, including command-line and non-Texis-Web-Server scripts, and it can set variables and call functions within the script.

An exit function is useful for logging transactions or printing the bottom part of look at feel HTML. It is called when the script ends normally, ie. not via exit.


EXAMPLE

<ENTRYFUNC = checkperms>
<EXITFUNC = logtransaction>

<A NAME=checkperms PRIVATE>
  <if "127.0.0.1" neq $REMOTE_ADDR>
    You are not authorized to use this application. <exit>
  </if>
  <HTML><HEAD><TITLE>My Application</TITLE></HEAD>
  <BODY BGCOLOR=white>
</A>

<A NAME=logtransaction PRIVATE>
  <SQL "insert into log(ip, query)
        values($REMOTE_ADDR, $QUERY_STRING)">
  </SQL>
  </BODY>
  </HTML>
</A>

<A NAME=main PUBLIC>
  Hello.
</A>

<A NAME=edit PUBLIC>
  ... edit form ...
</A>

Every run of the script - whether to main or edit or some future function - will first execute checkperms to check permissions and print opening HTML. At the end (if exit is not called), logtransaction will be called to log the transaction.


CAVEATS
The ENTRYFUNC and EXITFUNC directives were added in version 5.01.1098192447 20041019.


SEE ALSO
EntryScript (p.  gif ), ExitScript (p.  gif ),


Copyright © Thunderstone Software     Last updated: Wed Aug 6 11:57:09 EDT 2008
 
Home   ::   Products   ::   Company   ::   News   ::   Tech Support   ::   Demos   ::   Contact Us
Copyright © 2008 Thunderstone Software LLC. All rights reserved.