To automatically convert certain words into other words, create a database of words to be changed, and put the text to be converted inside a [ConvertWords] context. Any matching words will be changed to corresponding words in the database lookup table.
Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):
The above line of WebDNA would produce the following (given the proper glossary.db):
A Hypertext Transport Protocol request first uses Domain Name System to look up the Internet Protocol address
Here's what the glossary.db file would look like for the example above:
-- glossary.db --
from<tab>to
HTTP<tab>Hypertext Transport Protocol
DNS<tab>Dynamic Naming System
ip<tab>Internet Protocol
Anywhere the words in the from column appear in the text, they are replaced with whatever is in the to column. There is no limit to the length text in either the from or to columns. You may put any kind of text into either column; for example, HTML is legal in either column.
Parameter | Description |
---|---|
db
|
(Required) path to conversion database which contains list of "from" and "to" conversions of words to other words |
table |
New for WebDNA 5.x In place of a db file, you can specify a named reference to a WebDNA table object. |
case
|
(Optional) T or F to indicate that word comparisons should be case-sensitive or not. Default is F, case-insensitive |
word
|
(Optional) SS, WW, SW to indicate that words should be matched as SubString, Whole Word, or Start of Word, same as search parameters when matching text in a database |
delimiters
|
New for WebDNA 5.1 (Optional) List of single characters which define word boundaries. |
Some handy uses for [ConvertWords] include removing foul language from online message boards, spelling out acronyms, changing nicknames to full names, inserting hyperlinks, and expanding glossary terms. The following conversion database may give you some ideas:
-- conversion.db --
from<tab>to
WebDNA<tab><a href="www.webdna.us">WebDNA Software Corporation</a>
Mike<tab>Michael
foulword<tab>f******d
support<tab><a href="mailto:support@smithmicro.com">support</a>
logo<tab><img src="companylogo.gif">