WebDNA Tags and Contexts

A WebDNA tag exists on its own just like an HTML tag, with one major exception: It never "exists" as far as a browser is concerned. Instead, the WebDNA engine replaces the tag with text before being served to the browser. Think of WebDNA tags as server tags, and HTML tags as browser tags.

Like standalone HTML tags, WebDNA tags are replaced with some value. However, unlike HTML tags, the value used to replace a WebDNA tag is dynamic and can change depending upon the situation. This dynamic replacement makes your web pages much more active and interesting.

Let's look at an example of using a WebDNA tag to display the current date on a page. In HTML, the following normal text is needed:

Today's date is 06/24/2022.

However, in order to be accurate, the page would need to be edited every day to insert the correct date; this amounts to a waste of time and of course no one would really go to that length. What is really needed is a way to make the date update itself automatically, using the following simple WebDNA tag:

Today's date is [date].

WebDNA tags are not enclosed by angle brackets (< >). Instead, WebDNA tags are enclosed with square brackets ([ ]). Tags were designed this way intentionally to avoid possible confusion between HTML tags and to make code easier to read. In the above example, when a browser requests the page, the [date] tag is replaced by WebDNA on-the-fly with the correct date value. Going further, if you had HTML bold tags wrapped around the word "date", the template could look like the following:

Today's date is <b>[date]</b>.

All of your WebDNA tags are replaced by WebDNA with their proper values, and any HTML tags are left intact before being returned to the browser:

Today's date is <b>06/24/2022</b>.

Finally, the browser displays the text as:

Today's date is 06/24/2022

This is the very basic of WebDNA, but every journey stats with a first step...

With WebDNA, you will discover how to build the most complex applications, interacting with CSS3 and HTML5, with XML, searching information in one database and replacing batch of data in several others, using an extremely robust tool that has been proved to be useful even to the largest companies. WebDNA Team


Top Articles:

WebDNA: an incredibly flexible scripting language and database system

WebDNA is an easy-to-learn server-side scripting language specifically designed for creating feature rich...

WebDNA Tags and Contexts

A WebDNA tag exists on its own just like an HTML tag...

WSC Products

Welcome to WebDNA 8...

Fun with WebDNA Videos

These videos are created by Dan Strong...

What is WebDNA?

WebDNA is a scripting language application that connects with web servers for the purpose of adding dynamic and database-driven qualities to web sites...

Related Readings:

A short description of how WebDNA processes your web pages

WebDNA is a very powerful Server Side interpreter; it includes an unlimited...

WebDNA Contexts

A WebDNA context encloses a block of text and requires a beginning and ending tag...