Home > doc > serverpage 
 en fr de es it pl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh zh_TW eo
Voorgaande  Volgende  Bewerken  Hernoemen  Undo  Search  Administratie  
Handleiding  
Waarschuwing Deze pagina is niet vertaald.  Zie Engelse versie 
Gambas Server Pages
In Gambas, you have some sort of scripter hack that allows you to write ASP-like files that I named " server pages".

Put that in a text file, make it executable, and run it.

#!/usr/bin/env gbw3
<%
DIM sEnv AS String
%>

<!-- Variable declaration must come before any HTML -->

<html>

<h2>CGI script environmental variables</h2>

<table border="1" cellspacing="0" cellpadding="2">

  <tr>
    <th align="left">Name</th>
    <th align="left">Value</th>
  </tr>

<% FOR EACH sEnv IN Application.Env %>
  <tr valign="top">
    <td><%= sEnv %></td>
    <td><%= Application.Env[sEnv] %>&nbsp;</td>
  </tr>
<% NEXT %>

</table>

</html>

As you can see, the server page is a script, but the script executable is 'gbw3', not 'gbs3'.

'gbw3' is actually a symbolic link to 'gbs3'. When 'gbs3' detects than it is run from the 'gbw3' symbolic link, it knows that it will have to process a server page and not a script. Then 'gbs3' will transform the server page into...a normal script, and will execute it.

Except the initial line with the '#!/usr/bin/env gbw3' magic, the syntax is very similar to ASP pages.

Note that the gb.web component is used by default. So you can use the Session object, the Response object, the Request object, and so on.

These Gambas server pages are CGI scripts, and must be managed as any other script in your preferred web server.

This feature is experimental. Please report any problem you could have with it!