[Interpret]Any Text and [xxx][/Interpret]
Interprets the enclosed [xxx] values using the WebDNA interpreter.

To interpret [xxx] values stored in a database field, enclose them in an [Interpret] context. For example, if you put the text "[date]" into a field in a database (text1, for instance), then when you display [text1] in a template it only shows the literal text "[date]" -- it will not try to interpret the contents of the field. [Interpret][text1][/Interpret], however, first substitutes "[date]" for text1, then interprets the result as "1/29/97."

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[Interpret]Some Text that contains [xxx] fields[/Interpret]

Any WebDNA [xxx] tags are first substituted for their real values, which may contain more [xxx] tags. Then the resulting text and tags are interpreted as though they were typed into the template directly.

Why? A good example is a banner advertisement database: let's say you want to create a list of advertisements to display randomly at the top of every page in your site. This works well if the ads do not contain any [xxx] tags. But if you want to put [cart] information into the banner ad, you must use the [Interpret] context to cause the [cart] variable to be substituted for its real value.

-----BannerAds.db------
AdNumber    BannerHTML
1           <a href="Invoice.tpl?cart=[cart]">Invoice</a>
2           <img src="[random].gif">
-----------------------

Now let's look at a sample template that incorrectly uses the database above to randomly choose 1 item from the list and display the results at the top of a page:

<html><body>
[search db=BannerAds.db&neAdNumberdata=0&max=1&AdNumbersdir=ra&AdNumbersort=1]
[foundItems][BannerHTML][/foundItems]
[/search]
</body></html>

The problem here is that the [BannerHTML] is indeed evaluated and displayed, but it is incorrect because the [random] tag inside the field has not been evaluated to its true value:

<img src="[random].gif">

Now let's look at a sample template that correctly uses the database above to randomly choose 1 item from the list and display the results at the top of a page:

<html><body>
[search db=BannerAds.db&neAdNumberdata=0&max=1&AdNumbersdir=ra&AdNumbersort=1]
[foundItems][Interpret][BannerHTML][/Interpret][/foundItems]
[/search]
</body></html>

The results here are what we expected:

<img src="47.gif">