doc • webpage

WebPage Syntax

WebPage are HTML pages that support an extended ASP-like syntax to mix HTML and Gambas code.

New: Tryout the web page playground: https://gambas.one/playground/web.php

A WebPage is translated into a unique function that prints the HTML to the standard output and executes the included Gambas code 'as is'.

As a WebPage is rendered by an unique function, only local variables can be declared, and only at the top of the page, before any HTML code.

The supported syntaxes are the following:

Syntax

Description
<%Code%> Any Gambas code that will be executed 'as is'.
<%=Expression%> A Gambas expression that will be converted to HTML with the Html$ function.
<%--Comment--%> A WebPage comments that will be completely ignored, whereas normal HTML comments are emitted.
<%/%> A shortcut for <%=Application.Root%>.
<<WebPage [ Arg1_="_Value1_" , _Arg2_="_Value2_" ... ]>> Include another WebPage into the current WebPage. The syntax is similar to an HTML markup.
<%!Arg%> Insert the value of an argument passed to the <<WebPage>> markup.
<<--CONTENTS-->> Mark the limit between the header and the footer inside the included WebPage.
<</WebPage>> Insert the footer of the included WebPage.

Example

Here is the main WebPage:

Main.webpage

Type mismatch: wanted Long, got TextHighlighterStyle instead

And here is the included WebPage:

Page.webpage

Type mismatch: wanted Long, got TextHighlighterStyle instead