Technical References - [interpret]

Interprets the enclosed [xxx] values using the WebDNA interpreter.

numero = 260
interpreted = N
texte = [interpret]Any Text and [xxx][/interpret] 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/10." Example: [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    BannerHTML1           <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">
[interpret]Any Text and [xxx][/interpret]

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/10."

Example:

[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">

DOWNLOAD WEBDNA NOW!

Top Articles:

WebDNA Libraries

A list of available libraries for WebDNA...

WebDNA reference

...

[biotype]

BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

Download WebDNA Applications

WebDNA applications...

AWS Raw WebDNA LAMP-Plus WebServer

Amazon Web Services (AWS) README for Machine Image ID...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Related Readings:

[grep]

Replaces text based on a regular expression...

[authenticate]

WebDNA provides a few options for password protecting your pages...

[addlineitem]

Adds a product to the specified shopping cart...

[listmimeheaders]

Lists all the MIME header names and values sent from the remote browser...

[listfields]

Lists all the fields in the specified database...

[password]

Using [password] and [username] is an easy was to show the browser login dialog box...