Embedding inside HTML page

Scriptol code may be embedded inside HTML page exactly as Asp, PHP, Jsp, or any other web language. It uses similar tags and as it is compiled into Php code, it can use html and JavaScript variables or objects.

Scriptol in HTML page

When Scriptol code is embedded inside html, in the same manners Php is enclosed in php tags:

<? php ...code... ?>

scriptol is enclosed into scriptol tags:

<?sol ...code... ?>

Inside the tags, there is no difference with a standalone script. Take care tp separate the last statement of ?> by a semicolon if they stand on the same line. If you use a html editor that doesn't recognize these markers, use the following ones instead:

<script language="scriptol">
...code...
</script>

Writing 'scriptol' or scriptol is valid also.
The simplest way to use a Scriptol program in html is to call it with a include statement of Php:

< ? php require_once("count.php"); ? >

This is pure PHP and doesn't require the Scriptol compiler. You just have to compile count.sol to produce count.php.

Testing HTML pages

If you have installed a server as Apache or Xitami or Windows Server on your computer, and configured them to recognize the php extension, your code will be processed as on a the web, once compiled to PHP. Otherwise you have to type commands as:

 solp -w mypage

that produces mypage.php, and then to execute the Php code:

 php mypage.php > test.html 

The dynamic page is generated and redirected into the test.html file.


 Exercises

 

1) Display the today's date by creating the html.sol file, starting with a very simple html page:
<html>
<body>
<table><tr><td> </td> </tr> </table>
<body>
</html>

Use the Php function date("D/M/Y") to insert the date into the table defined by the <table> </table> tags.

To verify the result, compile the source with the command "Compile web page", inside the tools menu of the editor.
If you have not installed a server, type:

php -q html;php > test.html

Answer