|
|||||||||||||||
Download User Info New User FAQ Tutorials Demos Commands Variables Troubleshooting Sysop Info Sysop FAQ Theory Installation Management Tests Troubleshooting Feedback Resources Release Notes Credits Disclaimer |
Tutorial #1Talking to the World...In this tutorial, we will cover basic NeoWebScript ideas, building simple pages, handling variables and commands, and taking a look at some of the built-in variables and information available. This tutorial is broken down into the following categories: Probably the most important task NeoWebScript can perform is to put text onto a page. This "simple" task is incredibly important, since that text, in the form of HTML Codes (HyperText Markup Language), describes everything that you see and hear on a webpage. Image placement, links, video clips, Javascript, and audio files are arranged to form the final product under the direction of HTML files. Let's take a look at how NeoWebScript goes about generating HTML:
From any of your standard web pages, you can call out to NeoWebScript "in medias res" (in the middle of things). Simply insert the following bit of code in your document:
Try entering the above snippet into a web page of yours. You'll see that
your page looks the same right up to the NeoWebScript call, and it looks the
same afterward, but instead of the <nws>html "Hello, World!"
</nws>, you get the text
Even though emitting straight text isn't too exciting, it is very important, since NeoWebScript allows you to send out text that can change with each visit to your page. There are two ways of getting dynamic text out to the browser: Command Substitution and Variables. In NeoWebScript, a variable is a bit of text that stands for another bit of text. Let's look at the following segment to see how it works:
The $ before the letter "i" tells NeoWebScript that instead of putting out the letter "i", it should put out what "i" represents. Variables can be made up of letters, numbers, and a few symbols. The following are all valid variable names: i cur_time theirName MYNAME FloridaTaxIDYou can group variables together into arrays of data. Using arrays, it is easy to know what variables relate to what. For example, you may want to keep information about a particular task or user together, but still get to the information about that user. NeoWebScript uses parenthases to signify arrays. Take a look at the following example:
Every time somebody visits your page, the web server software creates an environment for you. The environment is nothing more than a collection of variables that describe the nature of the page, some basic information about the browser hitting the page, and infomation about the web server software. All of this information is kept in an array called webenv. You can easily tap into this set of information at any time, just like you would an array or set of variables that you created. What kind of information is kept in this array? Here's some of it:
If you are interested, a complete list of all the environment variables can be found at http://hosting.dynamis.net/tests/environment.nhtml.
In addition to variables, NeoWebScript can be dynamic by means of commands. Even though we didn't know about it, we've already visited a command. Remember html? 'html' is a command that takes whatever is after it and puts it into the current webpage. Although this command is very powerful, there are many other ones. They can do things like:
Here's an example:
To see a list of all the commands, try going by http://hosting.dynamis.net/commands/allcommands.nhtml. Let's try another example. If you look at the NEO_LAST_MODIFIED member of the webenv array, you'll see that the value is not one that we can really use. In fact, it's the number of seconds between the time the document was modified and January 1, 1970! That's not very convenient. Luckily for us, NeoWebScript has a command called clock that can format the result for us. We're going to access the webenv member called NEO_LAST_MODIFIED, feed it into the clock command, then feed that result into the html command. We also want to tell the clock command what to do with our seconds--we want it to format them. Here's how it all boils down:
If you're more interested in commands, don't forget that NeoWebScript is based on a language called Tcl, so pretty much anything that works under Tcl will work under NeoWebScript. |
||||||||||||||
Copyright © 1995-1999 NeoSoft Inc., 1770 St. James Place, Suite 500, Houston, TX 77056 USA. All Rights Reserved |