The [interpret] context is very powerful command in the hands of a skilled WebDNA programmer.
numero = 127[text]variable1=[/text][text]variable2=[/text][text]variable3=[/text]...[text]variable8=[/text]However, there is an easier way to set them all using the [loop] context.
[loop start=1&end=8][text]variable[index]=[/text][/loop]Later in your code you could call the variables individually by simply placing the [variable1], [variable2], [variable3] ... [variable8] where needed. But if you need to display them all at once you can use the [loop] again.
[loop start=1&end=8] [interpret][variable[index]][/interpret][/loop]The [interpret] context is a vary powerful way of processing code inside code, and you need to be extra careful with your usage of the brackets when using [interpret] because it's easy to forget one of the ]. Understanding this is tricky for new programmers so let's break down the above example step by step:WebDNA will always process from the inside out as explained here:In this example the [index] provides the numbers 1 through 8.Take the numbers and insert them where you see [index][variable[index]] becomes [variable1]Expanding outward we then have [interpret][variable1][/interpret]When WebDNA sees this it will return the information stored in the variable.The [interpret] context is very powerful command in the hands of a skilled WebDNA programmer. It allows you to create truly dynamic code. Let's suppose you have need a simple array of eight variables. We could name them sequentially like this:
[text]variable1=[/text]
[text]variable2=[/text]
[text]variable3=[/text]
...
[text]variable8=[/text]
[loop start=1&end=8]
[text]variable[index]=[/text]
[/loop]
[loop start=1&end=8]
[interpret][variable[index]][/interpret]
[/loop]
DOWNLOAD WEBDNA NOW!
A list of user-submitted tips ...
Technical Change HistoryThis Technical Change History provides a reverse chronological list of WebDNA changes...
Download WebDNA ApplicationsWebDNA applications...
F.A.QA compilation of some user's questions...
WebDNA LibrariesA list of available libraries for WebDNA...
WebDNA ModulesA list of the currently available modules...
It's January 1st and you have to update the copyright notice at the bottom of all your websites...
Annoying character on writefileHow do I get rid of or convert the line feed character during a writefile?...
Export data to ExcelHere's a handy way to export your data to a text or Excel file...
How to setup CODA to work with WebDNA?This page will show graphically how to setup CODA as a WebDNA partner :-)...
Handling credit card numbersEncrypting the credit card numbers does the job quite nicely...
random password-generator codeGenerate a random alpha-numeric string...