HTML Fields in TOWeb

The source code of your web pages can not be deleted or changed as TOWeb automatically generates or regenerates all your web pages. But you if you have some HTML code or scripts inside you can had them to your topics using TOWeb HTML Script Fields. Depending on your needs you may also Use a TOWeb Text Fields. Both types of scripts can have additional files.

You can insert or edit TOWeb fields when editing a paragraph using the field button but also create or manage all your scripts from the "Settings > HTML" step.

Script Fields

The example of %DATE% for the current date in JavaScript.
1) From the Fields' Editor create a new field by clicking on the Add the new field
2) Its default name is NEW_FIELD. Rename it to DATE
3) Set the Field Type to "HTML Script"
4) In the Script Field Content replace the default script with a copy/paste of the following lines of JavaScript source code :

<script>
var d = new Date();
document.open() ;
document.write(d.getDate());
document.write("/");
document.write(d.getMonth() + 1);
document.write("/");
document.write(d.getFullYear());
document.close() ;
</script>

5) Inside one of your topic add the following text :
The current date is : %DATE%
6) Generate and you should see, instead of %DATE% the current date displayed on your web page.

This simple script is just a small example of a JavaScript code displaying the current date. You may create or copy/paste more complex scripts containing HTML, Javascript, ASP, PHP, applets, etc.
If you need to use additional files in the topic for your script (like for instance images, videos or applets) you can add them to the list of additional files.

PHP and ASP scripts
If you want to include a PHP (or ASP) script you need to use the Script Field as previously described but also have rename the topic file name with the file extension ".php" or ".asp" depending on your script language. By default TOWeb gives to your topic an "Automatic" page name base on the topic title. To set or change a topic filename, just go to the "Topic settings" and inside the Search engine optimization type your filename with its filename extension before to press the check button aside.

Text Fields

The example of %ADDRESS%

1) From the Fields' Editor create a new field by clicking on Add the new field
2) Its default name is NEW_FIELD. Rename it to ADDRESS
3) Set the Field Type to Text
4) In the Text Field Content replace the default text ("Enter your field text here") by your full address. You may enter it on several lines like for instance :
911 Easy street
94043, Mountain View, CA
USA
5) Click on the OK button and save your changes.

Now you have created a field ADDRESS containing your address. Every time you will need to use your address in a paragraph of your topics, simply type %ADDRESS% (with % at the beginning and at the name) or insert it where you want with a right-clicking and by selecting ADDRESS from the popup menu.
Then generate your website and this %ADDRESS% will be replace by the address you entered in all the web pages where you use it.

This example uses an email address but you may use text fields for any other purposes and text content you need (a copyright notice, the name of your company, a phone number, your slogan, etc). In fact any text information (short or long) that you may use at different places in your web site but do not want to update every time every where.