Creates a new thread to execute WebDNA simultaneously with the current template.[spawn]Some Complex WebDNA[/spawn]
The HTML output from within a Spawn context is never displayed to the browser. While this may seem unhelpful at first, realize that the purpose of Spawn is to allow you to execute very lengthy operations without forcing the visitor to wait for them. The WebDNA in the spawned context could update a database several minutes later, wait for a 15 second credit card operation, create a WebDelivery file, flush a database to disk or many other useful things.
Before the spawn [elapsedtime]
-- Some WebDNA that takes a long time to finish
[loop start=1&endP00][showif 1=1][/showif][/loop]
After the spawn [elapsedtime]
the elapsedtime is very small, even though the loop inside the spawn could take several seconds. This is because your web browser sees the results of the template before the spawned WebDNA is finished.
Here are some common mistakes you should avoid:
|Remember spawn might start executing long after the original template that was created has gone away. spawn has no idea what the value of [index] is, because that comes from the outer [loop] context, which really 'belongs' to the now-gone exterior template. The correct method is to create a math variable to hold the [index] value, because spawn does keep a copy of all the math variables in existence when it was created.|
|This is bad for two reasons. Similar to the first example, spawn has no idea what the database field values are, because it is not truly inside the [founditems] context. Second, be very careful you do no create too many spawns -- they can use a lot of memory, and in this case if the [founditems] is more than a dozen or so; web server performance can degrade considerably. The correct example limits the number of spawns, and also uses a text variable to hold the value of the database field.|
Nothing within a SPAWN context will be delivered to the browser, nor will any HTML within the SPAWN be interpreted. SPAWN is intended to run time-consuming server-side tasks (like large database updates) without making the browser wait for it to complete.
[sendmail email@example.com&to=[email]&subject=not spam]
Blah blah blah ...
DOWNLOAD WEBDNA NOW!
A list of the currently available modules...AWS Raw WebDNA LAMP-Plus WebServer
Amazon Web Services (AWS) README for Machine Image ID...Download WebDNA Applications
WebDNA applications...WebDNA Libraries
A list of available libraries for WebDNA...WebDNA reference
A list of all WebDNA instructions...Technical Change History
This Technical Change History provides a reverse chronological list of WebDNA changes...
Deletes a folder from your website...[raw]
Displays enclosed text without interpreting the [xxx] tags in any way...[closedatabase]
Lists all the text and/or math variables which have been set earlier on a page...[version]