423,818 Members | 2,250 Online
Bytes IT Community

What is Miva Script

By Ed Bradburn
Information Officer, NISS

This introduction introduces the Miva scripting language (http://www.miva.com). Although unlike many scripting languages Miva is not open source (or free), it is nevertheless one of the more exciting tag-based languages, capable of producing powerful dynamic content for your website.This tutorial guides you through the features of Miva so you can see for yourself whether it might suit your web development needs.

A. What is miva script?

Miva is an XML-compliant scripting language which pre-parses Miva script files and returns HTML to the browser from this source file. In so doing, it can produce ordinary HTML, DHTML, Javascript, or Java configuration text, and is thus a very useful tool for handling most (if not all) of the common CGI taks required by today's dynamic web content. Although not as fast as CGI scripts written in C, or as powerful as those written in Perl, Miva scripts do have the advantage of being easy to code, simple to debug, and, since they are tag-based, familiar to many semi-technical authors used to writing Javascript, DHTML or simpel HTML, and who class themselves as 'web developers' than 'CGI programmers'.

Developed now by Miva Corporation (http://www.miva.com), it comes in many flavours for most platforms, is a very small (c. 700K) executable, and is simple to install, most setups requiring about 15-30 minutes from unzipping to running a test script.

B. What can it do?

Miva is very strong in the areas for which it was developed and much weaker in those that it was not. This makes it less of an 'all-rounder' like other scripting languages, but for the features it offers, it is hard to beat in terms of both development and maintenance of the systems it can set up. The areas Miva provides most utility in are as follows:

C. What can't it do?

Although Miva is being continously developed, and thus any or all of these may eventually no longer apply, there are some caveats to anyone considering using it currently for web development:

D. How it works

Simplicity is the key to Miva's power:

  1. A Miva script is called from the browser and is sent to the Miva CGI executable by the web server.
  2. The executable parses the script commands and incorporated HTML statements (conditionally or otherwise), and passes the results back to the browser as a standard HTML document.
  3. The browser interprets the HTML, which may include server-side includes, Javascript, Java configuration text and standard HTML of any flavour, and displays the result to the user.

E. Miva Script Example

<MVCOMMENT>This is not passed to the browser</MVCOMMENT>

<!-- this is passed to the browser as normal -->

<MVASSIGN NAME="var4" VALUE="<PRE>">

<HTML>
<HEAD>
<TITLE>A Miva Script program demo</TITLE>
</HEAD>
<BODY>
<H2>A simple program to demonstrate Miva</H2>

<MVASSIGN NAME="var1" VALUE="5">
<MVASSIGN NAME="var2" VALUE="8">
<MVASSIGN NAME="var3" VALUE="<P CLASS=\"hello\">Hello
there!</P>">

<MVIF EXPR="{5 GT 3}">

<P><B>Simple displaying of variables: &[var2]</P>
<P><B>Simple addition: <MVEVAL EXPR="{var1 +
var2}">.</B></P>
&[var3]

&[var4]
This is not interpreted as HTML, but shown 'as is':
&[var3]
</PRE>

<MVELSE>

<P>This will never occur with that condition!</P>

</MVIF>

</BODY>
</HTML>

F. Example Analysis

This short script demonstrates several things about Miva:

The next page of this introduction will discuss variables in more depth, and introduce Miva's best feature - databases.
  Miva Script Part 2 »