Step 1 - Getting Started

N.B. This tutorial will assume that you you're working in Gsharp's example/cgi-bin directory, which is aliased as /Gsharp-bin/ on your web server. It also assumes that the Gsharp examples are stored in /GsharpWE/ and that temporary image files can be found in /GsharpTmpFiles/.

Before continuing please make sure that the Gsharp Web Edition examples are installed and working. The home page of the examples is /GsharpWE/index.html. If you find problems work carefully through the steps in Configuring Your Web Server

If you are unfamiliar with the Common Gateway Interface (CGI) and how a web server can use scripts to make web pages, then please read this short explanation.

So, we're assumming that you now know that our scripts are executed by the web server, which captures the output and sends it back to the user.

We're going to start by just outputting a very simple HTML page without any graphics.

Create a file called myworld.gsw. If you are running on UNIX you will need to make sure that your script has execute permission. On Windows GsharpWE.exe should already be associated with *.gsw.

#!/bin/GsharpWE

echo("Content-type: text/html");
echo("");
echo("<HTML><HEAD>");
echo("<TITLE>Hello World</TITLE>");
echo("</HEAD>");
echo("<BODY>");
echo("<H1>Hello World</H1>")
echo("</BODY></HTML>");

On UNIX the best way to test this is to run the script in the same way that the server will:

./helloworld.gsw

On Windows the best way is with a program like textpad, which can run the script and capture the output for you. The alternative is a little more work. Start a command prompt and enter commands similar to the following:

cd c:\program files\gsharp\example\cgi-bin
..\..\bin\gsharpwe.exe helloworld.gsw

The reason we test our scripts like this is because if we try and run them in the web browser the error messages are often swallowed by the browser. For example the deliberate mistake in our example is easily spotted and fixed with the above methods, but looking at

/Gsharp-bin/helloworld.gsw

Displays "500 - An Internal Server Error". This is because the Gsharp Web Editition produces error messages instead of the valid headers which the server requires. e.g.

Content-type: text/html

When we add the missing semicolon to our script, the output is produced and
/Gsharp-bin/helloworld.gsw works ok.

Now go on to Step 2 - libhtml.gsl