corner black line corner
black line
the Hazel Logo Hazel Enterprise: The Internet Merchandising System The Netsville Logo
start red bar Home News Info Features Examples Purchase Support Contact Us end red bar
Documentation: Tags

Hazel's Markup Language ("HZML") shares a similiar syntax with HTML. HZML elements may be nested within other HZML elements, multiple HZML elements may appear on one line, and a tag's definition can span over multiple lines. All tags begin with "Hazel".

Tag names are case-insensitive (eg. HazEL is equivalent to HAZEL.) You can use either an underscore or a dash in the tag name (eg. "Hazel-Choice" is equivalent to "Hazel_Choice"), which might be beneficial when using editors which (rightly so) reject the underscore as invalid HTML and thus refuse to indent it with the rest of your code.

All HZML attribute values may contain HZML tokens, allowing you to insert store and user-defined variables into them.

HZML attribute names must be unique. If there are more than one attribute values with the same name in a single HZML tag, only the last value will be used. When necessary, certain HZML elements (such as Hazel-Math) allow you to merely begin an attribute name with a certain string, enabling you to pass more values to the HZML tag.

One troubleshooting tip worthy of mention: If your page appears largely blank, you might have forgotten the closing tag of an HZML element.

And a final tip: If something doesn't appear to be working despite all your attempts, make sure you have the latest version of Hazel! An attempt has been made to note the version requirements of each feature, but nobody's perfekt. See the download page to make sure you're up to date!

<Hazel-API />

H4 Unix versions only; available as of Hazel 3.99I
Src=scriptname

A file within your CGI root. It will be executed as a Hazel API script. The script will be called with a single argument--the client-id of the current shopper. It is unwise to include an %HZE token in this value; doing so could allow a shopper to execute any file in your CGI_DIR directory!

Argstr=args

If an argstr value is given, it is appended to the command line of an EXEC'd script, after the client-id. H4 only; available as of Hazel 3.9CX. As above, be careful using %HZE tokens in this value.

Result=vkey

If a result vkey is given, the exit status of the API call is stored in that spot in the %HZV namespace. A true result indicates there was some error, a false result means success. Available as of Hazel 4.044.

The Hazel-API element allows you to execute a Hazel aPI script at any point within a file served by Hazel. Its output is parsed by the Hazel API engine, then discarded.

The "script" can be any executable file: compiled, interpreted, shell script, anything that will run on the host system. However, Netsville only provides an interface (Hazel.pm) for Perl.


<!-- Load shopper data for this client. -->

<Hazel-API Src="load_shopper_data.pl">

<Hazel-Belch > ... </Hazel-Belch>

H4 only; available as of Hazel 3.9CV
File=file

A file located (by default) under your current theme root, or hazel-cat if no active theme.

Basedir=path

An alternate base for the relative src filename. Must be under either your hazel-doc or hazel-cat directories.

Append

If true, append to the file rather than overwriting it.

Clobber

If true, allow an existing file to be overwritten.

Protect

If true, protect the file in the same manner Hazel read/write protects your userfiles, orders files, and other sensitive data.

Result=vkey

If a result vkey is given, the exit status of the file write is stored in that spot in the %HZV namespace. A true result indicates there was some error, a false result means success. Available as of Hazel 4.044.

The Hazel-Belch element allows you to write its body to a file.


<!-- Append a note to a log file in hazel-cat/log.txt. -->

<Hazel-Belch File="log.txt" Basedir="%HZM_CAT_DIR" Append >
%HZH_DATE: Log message entered.
</Hazel-Belch>

<Hazel-Choice />

Token=subject An text, usually an HZML %HZI token.
True=true_text Any text; may contain any HZML %HZ tokens.
False=false_text Any text; may contain any HZML %HZ tokens.
EXPR=search_expression Token matches the given Hazel search expression.
SEQ=string SNE=string Token is equal to or not equal to the given string.
SIN=string SNI=string Token does or does not contain the given string.
BEFORE=datestring AFTER=datestring
PAST PRESENT FUTURE
Token is a date of the form YYYYMMDDHHMMSS. A question mark in the date matches anything. (Eg. ????1225 matches Christmas of any year.) True if that date is before or after the given date, or in the past, present or future relative to the current date (in the webserver's local timezone.) H4 only; available as of Hazel 4.044.
EQ=number NE=number
GT=number GE=number
LT=number LE=number
Token is equal to, not equal to, greater than, greather than or equal to, less than, or less than or equal to the given number.
MOD=number Token is not evenly divisible by the given number.
FExists=filename True if the filename given references an existing file. Filename must be a full path, so use %HZM_DOC_DIR, %HZM_CAT_DIR, etc. when necessary. Available only in H4, as of beta 3.955
RE=regex_pattern True if token matches the given regular expression pattern. See the Hazel-Regex tag documentation for more information, and note that %HZV_RE* tokens will be set and available in the body of your loop if the match succeeded. Available only in H4, as of beta 3.99L.
AND By default, the truth of any one of the given attributes will cause the entire element to evaluate truthfully. If AND is given, then all attribute expressions must evaluate true.

Hazel_Choice is replaced with true_text if the expression described by its attributes is true, and false_text if it is not. If no comparison attribute value or search_expression is given, then the token is true if it is defined and not zero.

While you can use HTML markup within a Hazel_Choice tag (just make sure you quote the values of the TRUE/FALSE attributes), larger blocks of HTML are better served by the Hazel-True and Hazel-False tags, which surround entire blocks of conditionally-printed text.

Including the lonely AND attribute anywhere in the tag means that every comparison attribute must match in order for the entire tag to evaluate true.

Search expressions are as fully qualified search expressions should be, but without a fieldname. For example, "+=3" means "the token must equal 3." (Contrary to its typographical appearance, it does not match any product marketed towards bishops with mammoth hooters.)

To use more than one expression with the same attribute name, simply begin it with the attribute's name above. For example: EXPR1="+=foo" AND EXPR2="-=bar"

You can use the search expression condition even if you have not purchased a search key.


<!-- Text replacement depends on whether or not product FOO has been selected. -->

<Hazel_Choice Token="%HZQ_FOO"
    True="Good choice; FOO is an excellent buy."
    False="Why not grab a FOO while you're here?">

<Hazel_Choice Token="%HZT_MERCH" Expr="+>1000.00"
    True="You've bought over $1000 worth of junk.  Maybe it's time to go home."
    False="You haven't even spent $1000 yet--keep buying!">

<Hazel_Choice Token="%HZE_HOBBY" Expr="+%art"
    True="Your primary hobby contains the word ART."
    False="Not an art lover?">

<-- Same, but using regular expression matching. -->
<Hazel_Choice Token="%HZE_HOBBY" RE="[[:<:]]art[[:>:]]"
    True="Your primary hobby contains the word ART."
    False="Not an art lover?">

<Hazel-True> ... </Hazel-True>

<Hazel-False> ... </Hazel-False>

Hazel-True and Hazel-False take the same attributes as the Hazel-Choice tag, except for the TRUE and FALSE attributes. Instead, the contents of the element body contain text to be displayed if the result of the expression is true or false. Here's an example:


<!-- If the user has entered his first name,
     issue a friendly greeting.  -->

<Hazel-True Token="%HZE_BILL_FNAME">
<p>Howdy, %HZE_BILL_FNAME!</p>
</Hazel-True>

<Hazel-Comment> ... </Hazel-Comment>

Delete If given, remove the body of the element altogether. H4 only; available as of beta 3.969.

Text within the body of a Hazel_Comment element will be ignored by the HZML renderer and passed on unchanged. It will be displayed to the browser, but no tags, tokens, or other HZML will be rendered by Hazel. If you also want to hide it from the browser, insert HTML comments within it.

To delete the body of the element altogether, use the Delete attribute with Hazel version 4.


<!-- Use Hazel_Comment to temporarily disable blocks of HZML. -->

<Hazel_Comment>
<Hazel_Slurp Src="dont_slurp_me_anymore_or_i_call_the_cops.txt">
</Hazel_Comment>

<Hazel-Currency />

Type=currency-code

A currency code from your currency.rules file. Defaults to %HZE_CURRENCY.

Amount=amount

A numeric amount (eg. a product price) in your base currency, as represented in your products file and elsewhere.

Result=HZV_Key

If given, the result is saved into %HZV namespace under this key (instead of being implicitly included in the document.) For example, a key of "Result" would save the result into %HZV_RESULT. Available as of Hazel 3.456/3.99H.

A Hazel-Currency tag will be replaced with the given AMOUNT converted to currency given as TYPE, as dictated by the exchange rates in your currency.rules file. See the Hazel documentation on currency for more info.


Welcome, Canadian Shopper! Here is an approximate total for your order converted to Canadian dollars:

<Hazel-Currency Type="cnd" Amount="%HZT_ORDER">

We're all aboot beauty prices here, eh? Wait, I didn't mean any offense! Don't take off, you hoser!

<Hazel-Current />

Value=skuid

A valid SKUID from your products file.

LastAdded

Set product context to the last SKUID in the shopper's cart.

FirstAdded

Set product context to the first SKUID in the shopper's cart.

The Hazel-Current tag sets the SKUID context when using %HZI tags. It's a simple way to use %HZI without the overhead of a products loop.

<!-- Set %HZI context to product with SKUID FOO -->

<Hazel-Current Value="FOO">
A FOO costs only %HZI_PRICE!

<!-- Set %HZI context to product with SKUID BAR -->

<Hazel-Current Value="BAR">
A BAR costs only %HZI_PRICE!

<Hazel-Date />

LastMod

Use the last modification date of the current file as the time to be calculated, rather than the current time. This will work only on served catalog pages -- not templates.

RefDate

Use the given date as the one for which the time should be calculated, rather than the current time. Format is either YYYYMMDD or YYYYMMDDHHMMSS (eg. 20030909142036.) H4 only; available as of Hazel 4.029

RefSeconds

Use the given seconds since the epoch as the time to be calculated, rather than the current time. To retrieve seconds since the epoch, see the Seconds attribute below. H4 only; available as of Hazel 4.029

ForACookie

Output suitable for an HTTP cookie expiration date (RFC1123). (Eg. Tue, 23 Feb 1971 05:00:00 GMT.)

HazelDate

Use Hazel's timestamp format, as with an %HZD token. (Eg. 19710223000000.) H4 only; available as of Hazel 4.029

Seconds

Output seconds since the epoch (~1970.) H4 only; Available as of version 4.005.

Adjust=[PF]x[HMSDLY]

Using the same format as the %HZD tokens, adjust the reference time by this amount. H4 only; Available as of version 4.036. Note: ADJUST and FORMAT arguments are mutually exclusive! You cannot use them together in the same <HAZEL-DATE> tag.

GMT

Use Greenwich Mean Time instead of the local time.

Format=string

An optional string describing how the time should be displayed. See below for common substitution tokens available in the format. Note: ADJUST and FORMAT arguments are mutually exclusive! You cannot use them together in the same <HAZEL-DATE> tag.

Result=HZV_Key

If given, the result is saved into %HZV namespace under this key (instead of being implicitly included in the document.) For example, a key of "Result" would save the result into %HZV_RESULT. Available as of Hazel 3.456/3.99H.

See also the %HZD date token class.

Print the current date and time. Without an explicit format (eg. via one of the Format, HazelDate, ForACookie attributes), it will appear something like Fri Feb 06 12:34:34 1998 EST, modified for your timezone. Within a format attribute value, you can use any of these tokens:


%%    A percent sign.

%H    Hour in 24-hour format, fixed at 2 characters, eg. "13", " 4"
%k    Hour in 24-hour format, without fixed width eg. "13", "4" (*)
%p    "AM" or "PM"

%M    Minutes after the hour, fixed at 2 digits
%S    Seconds after the hour, fixed at 2 digits

%I    Hour in 12-hour format, fixed at 2 characters, eg. " 4"
%l    Hour in 12-hour format, without fixed width eg. "4" (*)

%d    Day of month, fixed at 2 digits
%e    Day of month, without fixed width (*)

%m    Numeric month, fixed at 2 digits

%Y    Year, fixed at four digits
%y    2-digit year

%G    Timezone offset from GMT, eg. "0500" (*)
%Z    Current timezone abbreviation, eg. "EST", "EDT", "GMT"

%A    Full weekday name, eg. "Monday"
%a    Abbreviated 3-character weekday name, eg. "Mon"

%B    Full month name, eg. "February"
%b    Abbreviated 3-character month name, eg. "Feb"

Items marked with (*) are not available on Windows servers.

<!-- Show when the catalog page was last modified. -->
<p> This file was last modified at <Hazel-Date Lastmod>.</p>

<!-- Dump all the format tokens -->
<p>
<Hazel-Date Format="Percent(%%) FixedHour(%H) Hour(%k) AMPM(%p)">
<Hazel-Date Format="Minutes(%M) Seconds(%S) FixedHour12(%I) Hour12(%l)">
<Hazel-Date Format="FixedMonthDay(%d) MonthDay(%e) MonthNumber(%m)">
<Hazel-Date Format="Year4(%Y) Year2(%y) TZOffSet(%G) TZ(%Z)">
<Hazel-Date Format="WeekDayFull(%A) WeekDay3(%a) MonthFull(%B) Month3(%b)">
</p>


<!-- Twiddling with a certain date -->
<Hazel-Date RefDate="20000101" Adjust="F3D" HazelDate="True" Result="AFTER" />
<p>%HZV_AFTER is three days after Y2K.</p>

If you're running Hazel on a Unix server and have access to a shell account on that server, you can type man strftime there to see a full list of valid format tokens.

<Hazel-Digest />

H4 only; available as of Hazel 4.003
Value=inval Value to be digested.
Type=digtype "HMAC" or "MD5". Default is a hexidecimally encoded MD5 digest. HMAC uses MD5 for its hashing algorhythm. As of Hazel 4.065, type "CRYPT" will perform the standard crypt() function on the value. See the Salt attribute below for specifying the salt value.
Key=keystring Key to be used for HMAC digests.
Salt=saltstring Salt for type "crypt" operations.
Result=varname %HZV variable in which to store the result.

Hazel-Digest creates a cryptographic digest of the given value. If you don't know what that is, well, just forget I said anything.

<h2>HMAC Daddy</h2>

<Hazel-True Token="%HZE_INSTR">
<Hazel-Digest Value="%HZE_INSTR" Key="%HZE_INKEY" Result="HMAC" Type="HMAC" />
<Hazel-Digest Value="%HZE_INSTR" Result="MD5" Type="MD5" />
<table>
<tr>
<th bgcolor="gray">Input String</th>
<th bgcolor="gray">Key</th>
<th bgcolor="gray">HMAC</th>
<th bgcolor="gray">MD5</th>
</tr>
<tr>
<td><tt>%HZE_INSTR</tt></td>
<td><tt>%HZE_INKEY</tt></td>
<td><tt>%HZV_HMAC</tt></td>
<td><tt>%HZV_MD5</tt></td>
</tr>
</table>
</Hazel-True>

<form action="%HZU_FORM">
Input Str <input type="text" name="INSTR" value="%HZE_INSTR" />
Input Key <input type="text" name="INKEY" value="%HZE_INKEY" />
<input type="submit" value="HashIt" />
</form>

	

Portions derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm.

<Hazel-Dims />

H4 only; available as of Hazel 3.958
SRC=filename

An image filename. Use %HZM_DOC_DIR to build the proper full path.

Result=HZV_Key Where in the %HZV namespace to store the results. Defaults to DIM, with X dimension (width) in %HZV_DIMX, Y dimension (height) in %HZV_DIMY.

Read in the given image and attempt to determine its dimensions. Supported image formats are GIF, JPEG/JFIF, and PNG. Dimensions are stored in HZML tokens %HZV_DIMX and %HZV_DIMY by default.

<Hazel-Vset Name="IMG" Value="images/hazel.gif">
<Hazel-Dims Src="%HZV_IMG">
<p>Here we have a %HZ{V_DIMX}x%HZ{V_DIMY} piece of art by the name of %HZV_IMG.  Enjoy.</p>
<img src="%HZV_IMG" width="%HZV_DIMX" height="%HZV_DIMY">

<Hazel-Email> ... </Hazel-Email>

H4 only; available as of Hazel 4.021
To Email address of the recipient.
From Email address of the sender.
Subject Subject of the email.
Result=vkey

If a result vkey is given, the exit status of the email send is stored in that spot in the %HZV namespace. A true result indicates there was some error, a false result means success (successfully queued for delivery, but not necessarily received by the intended recipient.) Available as of Hazel 4.044.

Send an email message, included in the body of the tag. The first and subsequent lines up to the first blank line are interpreted as extra headers for the email message, so start with a blank line if you have no custom headers.

<Hazel-Email To="quinn@netsville.com" from="frank@fazigu.org">
Subject: boom boom

Hello, Quinn!

baby go boom boom

Bye!

-Frank
-- 
frank@fazigu.org
</Hazel-Email>

<Hazel-Explode />

available as of Hazel 3.343
Src=string

Any text. As of Hazel 3.508/4.044, you may use "Value" instead of "Src".

Delimiter=char

A character which separates the individual elements in the given string. Defaults to the semicolon.

Prefix=string

The prefix of the variable name into which each element of the "exploded" string will be placed. Default is "WORD". See below.

The Hazel-Explode tag breaks a string into a series of individual values, then stores them into %HZV tokens. The best method of explanation is an example, so here it be:

<Hazel-Explode Src="FOO;BAR;BAZ">
%HZV_WORD1 will be "FOO"
%HZV_WORD2 will be "BAR"
%HZV_WORD3 will be "BAZ"

<Hazel-Getenv />

H4 only; available as of Hazel 3.9BO
Name=environment-variable-name

The system environment variable to be fetched.

Result=string

The %HZV token into which the result should be stored. Defaults to "RESULT", which would be accessed with %HZV_RESULT.

Hazel-Getenv can be used to fetch any environment variable from the operating system on which Hazel is running.

<p>Here's a list of a few environment variables.</p>

<ul>
<Hazel-Loop Type="Word" Src="PATH;SHELL;PATH_INFO">
<Hazel-Getenv Name="%HZH_WORD" />
<li><tt>%HZH_WORD = %HZV_RESULT</tt></li>
</Hazel-Loop>
</ul>

<Hazel-Loop> ... </Hazel-Loop>

The Hazel-Loop tag is important enough to warrant its own page of looping documentation. To skip directly to a particular sub-type of loop, use the links below.

<Hazel-Math />

available as of Hazel 3.429
Value=number

The base value (a number) on which we're operating.

OP=operation

An operation to perform on the given value.

Result=string

The %HZV token into which the result of all operations should be stored. Defaults to "RESULT", which would be accessed with %HZV_RESULT.

Type=INT|FLOAT

The numeric type of the final result. Defaults to INT, which are "rounded" whole numbers such as "2" and "4". If FLOAT, you'll get more exact numbers such as "2.22" and "4.20".

Base=INT

Express the result in the given base alphabet. Normal everyday spoken numbers are base 10. Hexadecimal (eg. 00-FF) is base 16. Binary (eg. 1000101) is base 2. H4 only; available as of Hazel 4.028

FromBase=INT

Interpret the input value as being expressed in the given base alphabet. (See Base above.) H4 only; available as of Hazel 4.028

The Hazel-Math tag allows you to perform mathematical functions within Hazel, and store the result into an %HZV (V for "variables") token. "Operations" consist of an arithmetic operator followed by a number (or an HZML token representing a number.) Here's a list of all the valid operators:


+     Addition

-     Subtraction

*     Multiplication
x     Multiplication
X     Multiplication

/     Division

%     Modulo (remainder of a division operation)

Remember that any HZML attribute can contain HZML tokens itself, which allows you to perform math operations on arbitrary shopper input. Otherwise, you'd just be "math-turbating" with values you already know. That wouldn't be much fun now, would it?

If you want to perform more than one operation on the value, include multiple attributes beginning with "OP" such as "OP1", "OP2", "OP3" and so forth.

<Hazel-Math Value="1" Op1="+1" Op2="+3">
Hi! %HZV_RESULT is the fruit of our math-turbation.  It should be 5.

<Hazel-Math Value="%HZT_ORDER" Op="/2" Type="FLOAT">
%HZV_RESULT should be half of the order total, with two significant digits
so it appears as a dollar amount.

<Hazel-Math Value="%HZT_ORDER" Op="/2">
%HZV_RESULT should be half of the order total, rounded since we didn't
specify a FLOAT type.

<Hazel-Redirect />

H4 only; available as of Hazel 4.149ub1
URL=string

The URL to redirect to.

The Hazel-Redirect tag allows you to perform a 301 Redirect to a URL of your choice from within an HZML page.

<Hazel-Redirect URL="http://www.example.com/">

<Hazel-Regex />

H4 only; available as of Hazel 3.399K
Value=string

The string to examine with your pattern.

Pattern=regex or RE=regex

A regular expression pattern.

The Hazel-Regex tag allows you to perform regular expression pattern matches. The success of the match can be tested by looking at the value of the HZML token %HZV_RE0, which will contain the matching portion of the string.

Any parenthetical sub-matches are stored in %HZV_REx where `x' is their order of appearance in the pattern, from left to right, starting at 1 and ending with a maximum 9.

For more information on regular expressions, see our quickie primer.

Hazel's regular expression engine uses code from Henry Spencer's regex package, Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved.

<Hazel-Vset Name="String" Value="Foo Bar Baz Frobozz">
<Hazel-Vset Name="Pattern" Value="f(o{1,2}) (b)(a)(r) (b)(a)(z) (fr)(ob)(oz)(z)">

<Hazel-Regex Value="%HZV_STRING" Pattern="%HZV_PATTERN">

String: <code>%HZV_STRING</code><br>
Pattern: <code>%HZV_PATTERN</code><br>

<Hazel-True Token="%HZV_RE0">
	      <ul>
	      <Hazel-Loop First=0 Last=9>
			<Hazel-True Token="%HZ{V_RE %HZH_LOOP_COUNT}">
			  <li><code>%HZH_LOOP_COUNT: %HZ{V_RE %HZH_LOOP_COUNT}</code></li>
			</Hazel-True>
	      </Hazel-Loop>
	    </ul>
</Hazel-True>
<Hazel-False Token="%HZV_RE0">
<p>No match.</p>
</Hazel-False>

<Hazel-Slurp />

Src=filename

A file within your document root.

Template

If the Template attribute is given, Hazel will look in hazel-cat/templates for the slurped file instead of in your DOC_DIR.

Exec=scriptname

A file within your CGI root. It will be executed and the output inserted at this point. The script will be called with a single argument--the client-id of the current shopper. Available only on the Unix versions of Hazel. It is unwise to include an %HZE token in this value; doing so could allow a shopper to execute any file in your CGI_DIR directory!

Argstr=args If an argstr value is given, it is appended to the command line of an EXEC'd script, after the client-id. Available only in H4, as of beta 3.954
Result=vkey

If a result vkey is given, the exit status of the file slurp (or execution of the command) is stored in that spot in the %HZV namespace. A true result indicates there was some error, a false result means success. H4 only; available as of Hazel 4.044.

The Hazel-Slurp tag is substituted with the text contained in the file filename. SLURP is useful for inserting common text or HTML into all Hazel-served pages. For example, a copyright notice, an array of navigational buttons, or a client-side map.


<!-- Insert your copyright notice and contact information
     into this document at this point.  -->

<Hazel-Slurp Src="catalog_footer.txt">

<Hazel-Strip />

available as of Hazel 3.349
Src=string

Any text. As of Hazel 3.508/4.044, you may use "Value" instead of "Src".

Chars=string

All the characters (letters, numbers, etc) you want stripped from the string.

Complement

If given and true, strip all but the given characters.H4 only; available as of Hazel 4.035. As of Hazel 4.137, you can use Compliment. Shh! Don't tell your English teacher!

Result=vkey

If a result vkey is given, the resulting string is stored in that spot in the %HZV namespace, instead of replacing the tag itself. Available as of Hazel 3.508/4.044.

A Hazel-Strip tag will be replaced with the specified SRC string, minus any characters in the CHARS string.

Note from the example below that CHARS is case-sensitive.


Hi, Shopper!  Here's your name with all the vowels removed:
<Hazel-Strip Src="%HZE_BILL_FNAME" Chars="aeiouAEIOU" />

<Hazel-Length />

available as of Hazel 4.137
Src=string

Any text. You may use "Value" instead of "Src".

Result=vkey

If a result vkey is given, the resulting length is stored in that spot in the %HZV namespace, instead of replacing the tag itself.

A Hazel-Length tag will return the total length of string inside Src (or Value). May contain HZML (see example below).


<Hazel-Length Src="%HZE_BILL_FNAME %HZE_BILL_LNAME" Result="RESULT" />
If we assume the billing name "John Smith", %HZV_RESULT will equal 10.

<Hazel-Subst />

available as of 3.489/3.959
Value=string

Any text.

Search=string

The string you want to replace.

RE=pattern

Instead of a string, you can specify a regular expression pattern. H4 only; available as of 3.99T

Replace=string

The string with which to replace it.

UPPERCASE

Convert the string to all-uppercase letters. (Can be used with or without a search.) H4 only; available as of H4 beta 3.99R

LOWERCASE

Convert the string to all-lowercase letters. (Can be used with or without a search.) H4 only; vailable as of H4 beta 3.99R

Capitalize[=capmode]

If capmode is "word", capitalize the first letter of every word in the string. If it is "sentence", captilize the first letter of every sentence. If it is otherwise true, capitalize only the first letter of the entire string. H4 only; available as of H4 beta 3.9BR

Result=HZV_Key

Where in the %HZV namespace you wish the result to be saved. Defaults to RESULT (ie. %HZV_RESULT.)

Replace all instances of Search in Value with the Replace text, storing the result in the %HZV token specified by the optional Result attribute.

     <Hazel-Subst Value="DUCK" Search="UCK" Replace="ORK">

     %HZV_RESULT would have the value "DORK".

<Hazel-Tweak />

Padchar=character

Changes the padding character used in HZML tokens with right or left width justification formats, or in the Hazel-Wrap element. By default, Hazel uses a space character.

RoundSums=boolean

Set true (eg. "1") if you want %HZS tokens to be rounded into whole integer instead of floating-point decimal numbers. By default, %HZS tokens are displayed as floats.

Hazel-Tweak can be used to dynamically tweak various Hazel settings for a single page display/session.

<Hazel-Vset />

available as of Hazel 3.347
Name=string

Name of the variable to be set.

Token=HZML_Token

Name of the variable to be set, specified in the form %HZx_FOO where FOO serves the same function as the "Name" attribute above, and `x' is one of E, M, Q, or V. H4 only; available as of 3.99K. This attribute value is not parsed as HZML.

Root=HZML_Namespace

The Hazel namespace containing the variable to be set. An alternative to using "Token", this attribute value is parsed for HZML. Can be one of SHOPPER (%HZE), CONFIG (%HZM), VARIABLES (%HZV). H4 only; available as of 3.99T.

Value=string

Set the variable to this value.

Random=length

Set the variable to an English-sounding word "length" characters long. H4 only; available as of 4.025

The Hazel-Vset tag allows you to store values into %HZV (V for "variables") tokens, usually so that you can reference them later. You can use Hazel-Vset in conjunction with loops and Hazel choices to approach the capabilities of a full-blown programming or scripting language.

Remember that (unless otherwise noted) any HZML attribute can contain HZML tokens itself, which allows you to set variables to combinations of values from the config file, shopper input, and more.

<Hazel-Vset Name="FOO" Value="Foo">
Here is our FOO variable: %HZV_FOO.  It should equal "Foo".

<Hazel-Vset Name="FOO" Value="%HZE_BILL_FNAME %HZE_BILL_LNAME">
Here is our FOO variable: %HZV_FOO.  It should equal the first and last names
entered by the shopper.

<Hazel-Vset Token="%HZE_BILL_NAME" Value="Frank">
Here is the BILL_NAME variable in the `E' shopper namespace: %HZE_BILL_NAME.
It should equal "Frank", and will henceforth override any FOO value submitted
by the shopper, and will be saved to the user file.

<Hazel-Vset Token="%HZM_STORE_EMAIL" Value="quinn@netsville.com">
We just set the STORE_EMAIL hazel.config value to "quinn@netsville.com."
It will /not/ be saved back to the hazel.config file.  Depending on when
this HZML was rendered, it may or may not actually affect where your
store emails will be sent.  Setting an %HZM is a crap shoot.

<Hazel-Wrap> ... </Hazel-Wrap>

Wrapcol=number

The column (width) at which you wish to wrap the text. This is the primary attribute for Hazel-Wrap, and all most folks will need to use. You might want to skip the rest lest they BLOW YOUR MIND.

Spacecol=number

If there is no space at which we can politely break after this column, then we rudely chop the line at WRAPCOL, possibly in the middle of a (too long) word. Defaults to 3/4 of WRAPCOL. (Meaningless if FIXWIDTH is true.)

Fixwidth=boolean

If FIXWIDTH is true, every wrapped line will be WRAPCOL characters in length.

Padchar=character

If FIXWIDTH is true, this character is used to pad any extra columns required to reach WRAPCOL.

Prefix=string

Stick this string before each wrapped line. Useful if you'd like to blockquote some text.

Postfix=string

Stick this string after each wrapped line.

The Hazel-Wrap element allows you to wrap the text it contains into multiple lines of uniform columns.

For our example, we'll assume the shopper entered this enthusiastic rat-spoken elite hax0r note into ORDER_COMMENTS: "ur store is teh best EVAH i only wish u wuld hav more britny speers videos uh bcuz my lil sista liks them heeheheh :)) u r0x!!!11"

You want pretty text formattng for the store invoice emails you receive for each order, so you put this into store_invoice.txt:

|--------------Order Comments---------------|
<Hazel-Wrap Wrapcol=40 Prefix="|* " Postfix="*| " FixWidth=1>
%HZE_ORDER_COMMENTS
</Hazel-Wrap>
|-------------------------------------------|

When you receive the little bugger's order, you'll see his comments like so:

|--------------Order Comments---------------|
|* ur store is teh best EVAH i only wish u *|
|* wuld hav more britny speers videos uh   *|
|* bcuz my lil sista liks them heeheheh    *|
|* :))  u r0x!!!11                         *|
|-------------------------------------------|


Getting Started HZML Rules Extras Advanced Reference
Walkthrough
Configuration
Products File
Order Reporting
Platforms
Upgrading
Known Problems
Actions
HZML Tokens
HZML Tags
HZML Loops
HZML & HAM
Overview
Shipping
Sales Tax
Discounts
Surcharges
Tweaking
Customization
Input Fields
Softgoods
Search Engine
Optioned Products
Plugins
Design Tips
Themes
Currency
Payment Methods
Coupons
Regular Expressions
Perl API
hazel.config
Templates
HTML Basics
CGI and You
ChangeLog

Hazel Home - Help Contents - Searchable Knowledge Base - Live Technical Support

black line
corner black line corner