Macro Tags Available Everywhere [xxx] Tags that are Available Anywhere

The following tags can be used in any template file WebDNA displays. Additionally, if you have defined a SUFFIX-MAPPING and ACTION for WebDNA to process .tpl or .HTML pages, then simply using a web browser to link to any .tpl or .HTML page on your site is equivalent to performing a ShowPage using that file as a template.

Depending on the preference settings, you may have to include <!--HAS_WEBDNA_TAGS--> at the top of your files to indicate that WebDNA should interpret the [xxx] tags inside the file.

Note: These are not containers, so they should not be followed by a corresponding [/xxx] tag.

[AUTHENTICATE realm=Some Text]

Putting [AUTHENTICATE] in your template causes the remote browser to display the Username/Password dialog with whatever text you specify. When the visitor types a username and password into their browser, your templates can get that information by including the [USERNAME] and [PASSWORD] tags. Normally you put [AUTHENTICATE] inside [ShowIf] or [HideIf] contexts comparing the username/password, otherwise the password dialog continues popping up forever.

Note: [AUTHENTICATE] is a low-level tool requiring some sophisticated knowledge to use, so most people use the simpler [PROTECT] tag to password-protect a page. You can see an example of how [PROTECT] makes use of [AUTHENTICATE] by reading the WebDNA in the file "MultiGroupChecker" on your hard disk (in the WebCatalogEngine folder).

[BROWSERNAME]

Putting [BROWSERNAME] in your template displays the name of the remote browser program running on the visitor's computer.

[CalcFileCRC32 file=…]

New for 5.0
Putting [CalcFileCRC32file=...] in your template calculates the CRC32 value of a given file.

Example:

[CalcFileCRC32 file=../header.inc]

Results:

4016676240l

[CART]

Putting [CART] in your template automatically creates a unique shopping cart identifier that can be used in eCommerce commands such as Add, Remove, Purchase, etc. If no cart value is specified when you arrive at a page, then a new unique value is created. If you pass a cart value into the URL or form (propagating the same value from page to page), then that same cart value is used throughout the page.

[CART] is also handy for times when you just need a guaranteed-unique value somewhere, such as a record identifier or even a product SKU. For this reason, [cart] works in Typhoon as well as WebDNA.

[CLEARLINEITEMS cart=cartID]

Putting [CLEARLINEITEMS] in your template will remove all line items from the specified shopping cart. Normally carts are found inside the ShoppingCarts folder, but you may specify a cart in any folder by using file=/folder/cartID instead of cart=cartID.

[CLOSEDATABASE db=FileName]

Putting [CLOSEDATABASE db=FileName] in your template causes the specified database file (or full path) to be written and closed. This is only needed for special cases (usually before appending to a file) where you need to change a file perhaps cached in RAM. WebDNA automatically closes databases when it needs more memory, so you typically do not need to use this tag.
New for version 4.5
Adding 'commit=F' will cause the specified database file to be closed but not written to disk, so any unsaved changes will be lost.
Note: Appends are always written to disk immediately, so those modifications are not affected by using 'commit=F'.

[COMMAND]

Putting [COMMAND] in your template displays the WebDNA command that was used to get to this page. Some examples are ShowPage, Search, ShowCart, etc. These commands are often used in Form Actions, but can also be specified in an HREF hyperlink.

[COMMITDATABASE db=FileName]

Putting [COMMITDATABASE db=FileName] in your template causes the specified database file (or full path) to be written but not closed (so it will remain in RAM). This is only needed for special cases where you want to be absolutely certain that a database has been written to disk.

[COPYFILE from=FromFile&to=ToFile]

Putting [COPYFILE from=fred&to=wilma] in your template immediately copies the file called "fred" to another file called "wilma."

[COPYFOLDER from=FromFolder&to=ToFolder]

Putting [COPYFOLDER from=fredFolder&to=wilmaFolder] in your template immediately copies the folder called "fredFolder" to another folder called "wilmaFolder." The original folder remains where it is currently.

[CREATEFOLDER path=folder]

Putting [CREATEFOLDER StarShip/Troopers] in your template immediately creates a new folder with the name "Troopers" inside a folder called "StarShip" which is in the same folder as the template itself.

[DATE]

Putting [DATE] in your template displays the current date as defined by the clock on your web server. The format of the date is normally MM/DD/YYYY, but you can change the default format by changing the DateFormat preference. You can override the default date format preference on a case-by-case basis by specifying a format inside the tag, as in [DATE format=%m/%d/%Y]. See [Time].
Note: this [date] tag is sometimes confused with the [OrderFile]'s [date] tag, which is not the same thing. The [date] tag inside the context of an [OrderFile] represents the date the order was created, and does not have the ability to be formatted in special ways. If you want to display today's date inside of an [OrderFile], then you must first assign a text variable outside the OrderFile context, and use that text variable from then on:
[Text]todaysdate=[date][/Text]
[OrderFile cart=[cart]]
  Order Date: [date]
  Today: [todaysdate]
[/OrderFile]
 
Here are the valid date formats:
Format Description
%a
Abbreviated weekday name "Wed" *
%A
Full weekday name "Wednesday" *
%b
Abbreviated month name "Feb" *
%B
Full month name "February" *
%c
Date and time in the form Wed Sep 19 18:24:21 1997 *
%d
Day of month 01-31
%H
Hour 00-23
%I
Hour 01-12
%j
Day of year 001-365
%m
Month 01-12
%M
Minute 00-59
%p
AM or PM
%S
Seconds 00-59
%U
Week # of year (where Sunday is first day of week) *
%w
Weekday 0 (Sunday) - 6 (Saturday)
%W
Week # of year (where Monday is first day of week) *
%x
Date as Sep 11 1997 *
%X
Time as 14:01:12
%y
Year without century 00-99
%Y
Year with century 1900-2199. Note: on Linux systems, years earlier than 999 will not display 4 digits for the year.
%Z
Time zone of server
%%
%
  * These items depend on the underlying operating system's Y2K-compliance. Windows NT, for instance, will not display correct day-of-week-name results for years past 2039. The workaround is to use %w (weekday as a number) and perform your own lookup in a small database for the textual name of the weekday.

[DELETE db=DatabasePath&eqNAMEdata=Fred]

New for WebDNA 5.x - You can specifiy a WebDNA table, in place of a db file.
For example: [Delete table=TableName&...].
Putting [DELETE db=DatabasePath&eqNAMEdata=Fred] in your template opens the database specified by DatabasePath, finds all the records whose NAME field contains "Fred," and deletes those records. Any valid search parameters are allowed, as defined in the Search command and [Search] context. Note: if the database has username and password fields, then the records will not be deleted unless the visitor's web browser username/password match the record's username/password.
SQL/ODBC Note: To delete records from an ODBC-compliant table, use the [SQL] context.

[DELETEFILE file=FilePath]

Putting [DELETEFILE file=fred] in your template immediately deletes the file called "fred" in the same folder as the template. Paths are relative to the template, so "somefolder/fred" deletes the file down a level from the template inside a folder called "somefolder," while "../fred" deletes the file in the folder one level up from the template.

[DELETEFOLDER path=FolderPath]

Putting [DELETEFOLDER path=StarShip] in your template immediately deletes the folder called "StarShip" in the same folder as the template. Paths are relative to the template, so "somefolder/StarShip" deletes the folder down a level from the template inside a folder called "somefolder," while "../StarShip" deletes the folder inside the folder one level up from the template. All files inside the folder are deleted, and all subfolders are deleted, as though you had dragged the folder to the trashcan and emptied it immediately. This operation is not un-doable!

Note: if the parameter to [DeleteFolder] is an alias, then just the alias itself is deleted.

[ELAPSEDTIME]

Putting [ELAPSEDTIME] in your template displays the elapsed time (in 60ths of a second) since the beginning of processing this page. Put one at the top of a page, and another at the bottom to see how long the entire page takes to process (subtract the 2 numbers to get the answer).

[filecompare params...]

New for 5.0
Putting [filecompare params...] in your template compares the size, date, or CRC32 value of two given files.

Optional Tag Parameters:


· method - Size | Date | CRC32
· file1 - path of first file.
· file2 - path of second file.
· file1crc - arbitrary crc32 value, in place of an actual path for file1. (useful if you want to store the CRC32 value of a file and use it at a later time to test if the file contents have been changed)

results: method=Size
SMALLER - file2 is smaller than file1
LARGER - file2 is larger than file1
SAME - file1 and file2 are the same size

results: method=Date
OLDER - file2 is older than file1
NEWER - file2 is newer than file1
SAME - file1 and file2 have the same create date

results: method=CRC32

DIFFERS - the files differ in content
SAME - the files have the same content

Errors:

ERROR_FILE1 - 'file1' could not be found or opened
ERROR_FILE2 - 'file2' could not be found or opened
ERROR_BOTH - neither file could be found or opened

Examples:

 

[filecompare method=SIZE&file1=../create_tutorial.tpl&file2=../header.inc]

[filecompare method=DATE&file1=../create_tutorial.tpl&file2=../header.inc]

[filecompare method=CRC32&file1=../create_tutorial.tpl&file2=../header.inc]

[text]crc_value=[CalcFileCRC32 file=../header.inc][/text]
[filecompare method=CRC32&file1crc=[crc_value]&file2=../header.inc]

Results:


LARGER
OLDER
DIFFERS
SAME

[FLUSHDATABASES]

Putting [FLUSHDATABASES] in your template causes all databases to be written and closed. This is only needed for special cases (usually before appending to a file) where you need to change a file that may be cached in RAM, and you do not know the exact name of the database. WebDNA automatically closes databases when it needs more memory, so you typically do not need to use this tag.

[FLUSHCACHE] (available from version 4.0.2rc2 and later)

Putting [FLUSHCACHE] in your template causes all 'memorized' pages in memory to be immediately removed. Newer versions of any HTML or template files that have been modified on disk will be used the next time a browser links to those pages.

[FREEMEMORY]

Putting [FREEMEMORY] in your template displays the amount of memory available to WebDNA. This number is reduced whenever templates are cached, or databases are opened.

Note: This tag will not work on the OS X or FreeBSD platforms.

[GETCOOKIE name=cookieName]

Putting [GETCOOKIE name=fred] in your template displays the value of the cookie named "fred" that the remote browser has remembered. If no cookie of that name exists, then nothing is returned. Use [ListCookies] to see all the cookies your browser is sending.

[GETMIMEHEADER name=headerName]

Putting [GETMIMEHEADER name=Accept-Language] in your template displays the value of the MIME header called "Accept-Language," which is a code representing the human language that the viewer is able to read. Use [ListMIMEHeaders] to see all the headers your browser is sending.

[HTTPMethod] (available from version 4.0.2rc2 and later)

Putting [HTTPMethod] in your template displays the method by which the client browser requested the template. Resolves to either "GET" or "POST".

[INCLUDE file=FilePath]

Putting [INCLUDE FilePath] in your template replaces the [INCLUDE] tag with the contents of the specified file. The included file can use any [xxx] tags that will be substituted as though you had typed the entire contents of the file at that place in the template.

Note: normally all file paths are relative to the local template, or if they begin with "/" they are relative to the web server's virtual host root. As of version 3.0, you may optionally put "^" in front of the file path to indicate the file can be found in a global root folder called "Globals" inside the WebCatalogEngine folder. This global root folder is the same regardless of the virtual host.
 Optional Parameters Description 
[INCLUDE file=FilePath&raw=T] raw=T means the file should be included unchanged, without performing any [xxx] substitutions.
[INCLUDE file=FilePath&fromCache=F] fromCache=F means a more-recent version of the file should be read from disk, instead of using the cached version in RAM.
[INCLUDE file=FilePath&var1=xx&var2=yy] Passes any variable names (and their values) you choose into the included template, which can then use [var1] anywhere inside it.
[INCLUDE file=^test.inc] test.inc is found inside WebCatalogEngine/Globals/ folder

[IPADDRESS]

Putting [IPADDRESS] in your template will display the ip address of the remote computer that the visitor is using to view your site. All sections of the IP address are expanded to 3 digits, so that 207.67.2.14 will display as 207.067.002.014. This helps make partial comparisons inside [ShowIf] tags work more easily.

[ISSECURECLIENT]

Note: This tag will be supported through version 4.0. It will be eliminated in version 5.0.
Putting [ISSECURECLIENT] in your template replaces the [ISSECURECLIENT] tag with "T" if the remote browser is capable of SSL (Secure Socket Layer) connections, and "F" if not. As new browsers are released, you can control which ones are reported as secure by changing the "Browser Info.txt" file to indicate what level of HTML it supports, and whether or not it supports SSL.

[LASTAUTONUMBER]

Putting [LASTAUTONUMBER] in your template displays the same value as the last auto-generated number used in the last [Append] or [Replace] context that used the 'AUTONUMBER' parameter. Only valid for the current template instance.

[LASTRANDOM]

Putting [LASTRANDOM] in your template displays the same value as the last [RANDOM] number displayed. See [RANDOM]. The format of the number will match whatever format was used in the previous [RANDOM] use.

[LOOKUP db=databasePath&value=searchValue&lookInField=searchField&returnField=fieldName&notFound=TextIfNotFound]

New for WebDNA 5.1 - You can specifiy a WebDNA table, in place of a db file.
For example: [Lookup table=TableName&...].
Putting [LOOKUP] in your template performs an extremely fast search through the specified database and returns either the value of the returnField in the found record, or the literal text of the notFound value. The search is an case-sensitive, exact match, so "Grant" does not equal "grant." If you want more control over the search criteria, use a [SEARCH] context instead.

[MOVEFILE from=FromFile&to=ToFile]

Putting [MOVEFILE from=fred&to=wilma] in your template immediately moves the file called "fred" to another file called "wilma," and deletes the file "fred" after the move is complete. You may specify a different folder for the file to be moved to.

[PASSWORD]

Putting [PASSWORD] in your template displays the password entered into the remote browser's last Realm password dialog. See [USERNAME] and [AUTHENTICATE].

[PLATFORM]

Putting [PLATFORM] in your template displays the computer platform (Windows or Macintosh or Unix) that WebDNA is running on.

[PRODUCT]

Putting [PRODUCT] in your template will display the 'product' mode of the currently-running WebDNA program or plugin, i.e.'WebDNA' or 'Typhoon'.

[PROTECT groups=group1,group2]

Putting [PROTECT Groups] in your template causes the remote browser to display the Username/Password dialog until the visitor enters a username/password belonging to one of the specified groups. The Users.db database provided with WebDNA (and administered here) contains all the username/password/group information.

[PURCHASE cart=cartID]

Putting [PURCHASE cart=cartID] in your template moves the specified shopping cart file from the ShoppingCarts folder to the Orders folder, effectively the same as a Purchase command. If the cart file is not in a ShoppingCarts folder, you may use the alternate file=/folder/cartID instead of cart=cartID.

[RANDOM]

Putting [RANDOM] in your template displays a random number between 0-99. See [LASTRANDOM]. An optional format is a floating-point number between 0.0 and 1.0, with a granularity of 32768 intermediate values. [RANDOM format=float] will generate this alternate floating-point number.

[REDIRECT url=URL]

Putting [REDIRECT url=http://isd.smithmicro.com/] in your template forces the remote browser to immediately 'jump' to the new location specified, rather than displaying whatever is in the template. Any other text in the template will be ignored.

[REFERRER] or [REFERER]

Putting [REFERRER] in your template displays the URL of the referring page that led to this one. This is a handy way to give visitors a "back up" button. Note: this will not work if the previous page was a FORM METHOD="POST".

[REMOVELINEITEM cart=cartID&index=3]

Putting [REMOVELINEITEM] in your template immediately deletes the specified line item from the specified shopping cart file. Alternately, you may use the Remove command. See also [AddLineItem] and Add. If the cart file is not in a ShoppingCarts folder, you may use the alternate form file=/folder/cartID instead of cart=cartID.

[RENAMEFILE from=oldname&to=newname]

Putting [RENAMEFILE from=fred&to=wilma] in your template immediately renames the file called "fred" to "wilma."

[SETCOOKIE name=cookieName&value=cookieValue&expires=expireDate&path=/&domain=www.yourdomain.com]

Putting a [SETCOOKIE] tag into a template causes the remote browser to create or replace a cookie of that name in its local list of cookies. You can use [GETCOOKIE] or [LISTCOOKIES] later to retrieve that value from the remote browser. The expiration date of the cookie must be of the form Wednesday, 09-Nov-1999 23:12:40 GMT. The domain must be the name of your web server, otherwise the browser will not provide the cookie information.

Example:

[SETCOOKIE name=Visits&value=12&expires=Wednesday, 09-Nov-1999 23:12:40 GMT&path=/&domain=isd.smithmicro.com]

or one that expires 7 days from today (the +05:00:00 handles the US East Coast time difference from GMT):

[SETCOOKIE name=cookieName&value=sample&expires=[format days_to_date %A, %d-%b-%Y][math]{[date]}+7[/math][/format] [math time]{[time]}+{05:00:00}[/math] GMT&path=/&domain=www.yourserver.com]

Note: if you do not specify an expires parameter, then the cookie becomes a "session cookie," expiring automatically when the browser quits.

Controlling the scope of cookies

The path and domain parameters are used to restrict the scope of a cookie.

The default value for path, '/', will allow any template on the website to access the cookie. You can confine a cookie to a specific directory. For instance, if you specify a path value of '/admin/', then only templates within the '/admin' directory can access the cookie.

Setting the domain parameter limits which domain may access the cookie. If you specify 'www.yourdomain.com', then only templates within that domain can access the cookie. Specifying just 'yourdomain.com' for the domain, will allow templates from 'www.yourdomain.com', 'secure.yourdomain.com', or 'whatever.yourdomain.com' to access the cookie.

[SETMIMEHEADER name=headerName&value=headerValue]

Putting a [SETMIMEHEADER] tag into a template causes WebDNA to add a new MIME header to the outgoing HTML text for that page. MIME headers are normally used to create redirect requests and cookies. WebDNA already has special tags for generating redirects and cookies, but in the future you may need to create MIME headers for other purposes.

[THISFILE]

Putting [THISFILE] in your template displays the platform-specific filesystem full path of the current template page being displayed. The path separators are platform-specific, so the path will look different depending on what MacOS, Windows, or Unix computer system is used.

[THISURL]

Putting [THISURL] in your template displays the URL of the current page being displayed as a relative path from the root of the server hierarchy.

[TIME format=FormatSpec]

Putting [TIME] in your template displays the current time set on your web server's clock. The format of the time is normally HH:MM:SS (24-hour clock), but you can change the default format by changing the TimeFormat preference. You can also override the default time format by specifying a format inside the tag, such as [TIME format=%H:%M:%S]. See [DATE] for details.

[USERNAME]

Putting [USERNAME] in your template will display the username entered into the remote browser's last Realm password dialog. See [PASSWORD] and [AUTHENTICATE]

[VALIDCARD accountNum=cardNumber&card=VISA+MC]

Putting [VALIDCARD] into a template displays "T" or "F" (True or False), depending on the value of the number in accountNum. If the accountNum is a reasonable credit card number for the specified bank network, then "T" indicates it is good. Conversely, "F" indicates it is bad. This does not call the bank to verify funds on the card -- it merely does a simple numeric checksum to verify the number is consistent with a credit card number.
Parameters Description 
accountNum
(Required) The credit card number. Any extra spaces or non-numeric characters will be ignored.
card
(Optional) Set card to the names of the credit cards that are allowed, separated by space or +. Possible values are ALL, IGNORE, VISA, MC, AMEX, DISC, JCB, DINER. If not specified, then ALL cards are allowed. IGNORE tells it to always validate the card regardless of its checksum.

[VERSION]

Putting [VERSION] in your template will display the version of the currently-running WebDNA program or plugin.

'Absolute Path'

Prefixing a file or database path with an "*" will force WebCatatog to treat the path as "absolute", and not relative to the template or virtual root. This is useful on platforms where using an alias in not an option. This feature is disabled by default, but can be enabled via the WebDNA administration page. This is similar to the use of '^' to specify a path relative to the WebDNA 'globals' folder.

[SQLDisconnect conn_ref=] New for 6.0

[SQLDisconnect] will close the database connection, releasing any resources (including any and all SQLResult variables) associated with the connection, and the [SQLConnect] variable name is freed and available for use again.

All SQL connections are terminated at the end of template execution anyway, so it is not required to use [SQLDisconnect]. However, it can come in handy if you wish to iterate several connections, re-using the same connection variable name for each connection.
Parameters Description 
conn_ref (or just 'ref')
(Required) - The name of the SQLConnect variable you have created via the conn_var (or var) parameter of a [SQLConnect] context you have already successfully executed.

[SQLRelease result_ref=] New for 6.0

[SQLRelease] will close the result set and variable name created by a [SQLExecute] context. The name is freed and available for use again.

All SQL result objects are released at the end of template execution anyway, so it is not required to use [SQLRelease]. However, it can come in handy if you wish to iterate several [SQLExecute] contexts, re-using the same result variable name for each SQL execution.
Parameters Description 
result_ref (or just 'ref')
(Required) - The name of the SQLResult variable you have created via the result_var (or var) parameter of a [SQLExecute] context you have already successfully executed.

[FindString Source=...&Find=...&MatchCase=...&Reverse=...&StartAt=...] New for 6.0

You can use the [findstring] global tag to find the location of a sub-string within a given source string.
For example:

[text]mystring=WebDNA is a powerful, easy to learn, scripting language.[/text]

[text]found_at=[FindString source=[mystring]&find=powerful][/text]

[showif [found]>0]
Found 'powerful' in source string at character position [found_at]
[/showif]

[hideif [found]>0]
String 'powerful' not found.
[/hideif]

result...
Found 'powerful' in source string at character position 13

Parameters Description 
Source
(Required) The character string to search.
Find
(Required) The character string to find.
MatchCase
(Optional) T/F - Default is 'F'. If set to 'T', the search will be case sensitive.
Reverse
(Optional) T/F - Default is 'F'. If set to 'T', the search is performed starting from the end of the 'source' string.
StartAt
(Optional) Sets the start position, in the 'source' string, from which to start the search. If not specified, the search will start from the beginning of the 'source' string. If the 'Reverse' parameter is set to 'T', the 'StartAt' position is relative to the end of the 'source' string.










































User Contributed Notes
AllTags  

annatrike - annatrike@gmail.com 
12/15/2011 at 07:01:32
hello people, buy cheap generic antibiotics:   
amoxicillin for sick macaw <a href= http://amoxicillin-amoxil.webstarts.com > amoxicillin tablets </a>
can augmentin cause acid reflux <a href= http://augmentinonline.webstarts.com > augmentin drug test </a>
relationship cytotec post partum hemmhorage <a href= http://cytotec-misoprostol.webstarts.com > misoprostol by mail </a>
azithromycin serious side effects ears ringing <a href= http://azithromycin-zithromax.webstarts.com > side effects of zithromax </a>

loan till payday.com - iprreygb@gmail.com 
04/24/2015 at 11:34:31
http://paydayloansonline1min.com/ - best sites for payday loans <a href=http://paydayloansonline1min.com/ > unsecured loan georgia </a>

Copyright © 2008 WebDNA Software Corporation, Inc.