More hazel.config


Here are the rest of Hazel's configuration fields. You may never have to bother with these, but if you do -- they'll be here for you.


Context Substitutions

Don't be afraid of that menacing "context substitutions" header. It simply describes special replacements Hazel can optionally perform on the HTML pages she serves. These replacements (substitutions) are performed on certain parts of HTML matching certain patterns (in context). Behold-- CONTEXT_SUBS.

Some context subs are useful for catalog designers which elect not to use Hazel's HZML tags and tokens. If their pages happen to be served by Hazel, she can perform such magic as inserting a proper BASE HREF (so that the web browser doesn't go looking for images in your cgi-bin), or adding a client id to calls to Hazel (to remember the shopper without complete reliance on cookies).

Context subs also come in handy for those using HTML editors such as Microsoft's Front Page, which have a nasty habit of replacing certain characters (such as "%") with their ISO entities ("%25"), or warning you that "%HZU_DOC_BASE" is not a valid URL. Seasoned users can get by these pitfalls by using the "WebBot". Indeed, FrontPage users should get to know the WebBot, because they'll probably need it a lot. It allows you to insert bare HTML markup which FrontPage/MSIE might not support.

Regardless, the context subs are there if needed. Each is a simple word, all specified in the value of the CONTEXT_SUBS separated by semi-colons. For example, if you wanted to turn on the LINKS and FORMS context subs, you'd enter:

CONTEXT_SUBS:FORMS;LINKS

That's not so hard, is it? Incidentally, semicolons are used throughout Hazel's support files to separate ("delimit") multiple options. Keep it in mind.

Now, without further mumbo-jumbic adieu, here are the context subs -- revealed!

LINKS
Searches for... The relative URL to your CGI. /cgi-bin/hazel.cgi
Replaces with... The relative URL to your CGI, plus the shopper's client ID. /cgi-bin/hazel.cgi?client=12345678

FORMS
Searches for... Any closing FORM tag. </FORM>
Replaces with... A hidden field defining the shopper's client ID, and the closing FORM tag. <INPUT TYPE=HIDDEN NAME=CLIENT VALUE=12345678>
</FORM>

BASE
Searches for... Any closing HEAD tag which was not preceded by a BASE HREF. </HEAD>
Replaces with... A BASE HREF pointing to Hazel's document root HTTP_DOC_ROOT, and the closing HEAD tag. <BASE HREF="%HZU_DOC_BASE">
</HEAD>

HARD_BASE
Searches for... Any closing HEAD tag which was not preceded by a BASE HREF with a value of %HZU_DOC_ROOT. This forces Hazel's "correct" document base, even if your catalog pages have hardcoded another. </HEAD>
Replaces with... A BASE HREF pointing to Hazel's document root HTTP_DOC_ROOT, and the closing HEAD tag. <BASE HREF="%HZU_DOC_BASE">
</HEAD>

FP_HZU
Searches for... A word starting with "HTTP://HZU." (must be entirely UPPERCASE). HTTP://HZU.DOC_ROOT
Replaces with... "%HZU_" and whatever else followed the original string. This is used to fool FrontPage into thinking a Hazel token is a valid URL. %HZU_DOC_ROOT

FP_PCT
Searches for... "%25HZ". %25HZU_ACTION
Replaces with... "%". %HZU_ACTION

HZ_CMT
Searches for... "<!--HZML" or "HZML-->" <!--HZML <BASE HREF="%HZU_DOC_BASE"> HZML-->
Replaces with... Nothing. Used to mask HZML markup from browsers when a page is not served by Hazel. <BASE HREF="%HZU_DOC_BASE">

LINKS, FORMS, HZ_CMT and BASE are enabled by default. You don't have to include them in your CONTEXT_SUBS line to use them. If you want to disable them, add a DISABLED_CONTEXT_SUBS field and include them in its value.


HTTP/CGI Fields

These fields modify the way Hazel interacts with your web server. They are primarily useful for troubleshooting troublesome trouble-making servers.

HTTP_CONTENT_TYPE

HTTP_CONTENT_TYPE may contain semi-coon delimited HTTP status codes for which Hazel should send an HTTP 'Content-Type' header. The only useful values recognized are "204" and "301". You shouldn't mess with this unless someone at Netsville tells you to.

HTTP_EXPIRES

HTTP_EXPIRES is the expiration time of each document served by Hazel, measured in seconds. If it is missing or '0', Hazel will set the document to expire immediately. If you set this, you may encounter problems with Hazel "not registering" additions to the cart (because of browsers retrieving a previous response from their cache); it's best to keep it at 0 so she can properly refresh information.

HTTP_LASTMOD

If HTTP_LASTMOD is set to '1', Hazel will included the HTTP 'Last-Modified' header with documents she serves. This is useful if you're using a method such as Javascript to show the last time a page served by Hazel was edited.

It's usually not a good idea to use this field, as some servers will (rightfully so) interpret the Last-Modified header as if they were receiving a static HTML page, and therefore tell the browser "nothing's changed", when in fact the final HZML-rendered document being presented to the browser, though unchanged as source on disk, has changed. This is manifested by some servers as a page hanging the first time it is reloaded, requiring an extra reload to actually display.

If you really want to display the date the document was last modified, skip the Javascript and use the HAZEL_DATE HZML tag with the LASTMOD attribute.

PROVIDE_HEADERS

Set PROVIDE_HEADERS to 1 if for some reason your server requires you to send full HTTP headers from a CGI. If all of your CGI filenames begin with nph-, you probably need to turn on this option.


Frames Fields

These fields modify the way Hazel's "frames mode" works. They might be useful for those who want a more complex frames layout than that included with the Hazel distribution.

DISABLE_TARGETS
ADD_TARGET
CHECKOUT_TARGET
FRAMESET_TARGET

Set DISABLE_TARGETS true to forbid Hazel from sending the HTTP 'Window-Target' header. That header provides a way for a CGI to specify a target for the content it serves, and is the foundation of Hazel's "frames mode".

Each of the fields below allows a value "disable" which prevents Hazel from sending any window target information. This is useful, for example, when you wish to target the checkout screens to a frame rather than opening them full screen.

ADD_TARGET is the window-id (frame name) Hazel specifies for ADD actions in frames mode. It defaults to "HZ_VIEW".

CHECKOUT_TARGET is the window-id Hazel uses when serving a checkout, confirm, or finish action. It defaults to "_top" (blowing away all frames and loading in the full browser window.)

FRAMESET_TARGET is the window-id Hazel uses when serving the frameset template. It defaults to "_top" (full window). You probably won't have a reason to change this. It might be useful if your site is being viewed through the frameset of another site and you wish to preserve that original frameset.


Yet More Fields

These fields defy classification. They struggle free from any box into which we attempt to shove 'em, but fall nicely into alphabetical order.

ALLOWED_EXTENSIONS

By default, Hazel will serve file with the extensions "html", "htm", or "txt". If you want to serve other extensions, add them (separated by semicolons) as the value of ALLOWED_EXTENSIONS.

CHECK_CCN

If CHECK_CCN is set to 1, Hazel will attempt to weed out obviously invalid credit card numbers. If you're testing, use a card number of "5432123456789012".

Note: In previous versions of Hazel, CHECK_CCN was "CARD_VERIFICATION".

CHECK_CCD

If CHECK_CCD is set to 1, Hazel will disallow credit card expiration dates in the past. If using this feature, be sure your CREDIT_YEAR input field is 4-digits!

CHECK_EMAIL

If CHECK_EMAIL is set to 1, Hazel will attempt to weed out syntactically invalid e-mail addresses. She'll perform these loose syntax checks on anything required in your field.rules file which contains "EMAIL" in its name.

CLIENT_MEMORY

This field describes which methods Hazel may use to remember the shopper between hits. It may have a value of "any" (try anything), or a semi-colon delimited list of "cookies", "browser", or "subs".

"cookies" means Hazel should send and receive cookies containing the shopper's client identification number ("client id").

"browser" means Hazel will store a list of Internet site and browser information for each shopper, and use that to try to determine the client id. (This is the same as setting REMEMBER_HOSTS true.)

"subs" means Hazel will insert HTML fields into the URL on pages she parses, which ensure that the client id is transmitted to her. (This is exactly equivalent to appending "FORMS;LINKS" to CONTEXT_SUBS.)

It's suggested you leave this field set to "any" -- that gives Hazel the greatest chance of remembering who's ordering what.

DEFAULT_ACTION

DEFAULT_ACTION defines what Hazel does when she isn't passed an action, which includes when she is first called. If set to "RETURN", she'll try to serve the last page visited by the shopper. If set to "HOME" (or if the shopper is a newcomer), she will serve the catalog START_PAGE. If DEFAULT_ACTION is unset, Hazel goes "HOME".

DISABLE_COOKIES

Set DISABLE_COOKIES to 1 if don't want Hazel sending or receiving HTTP cookies. If you disable cookies, Hazel will not remember shoppers unless you pass their client ID from link to link. While you are encouraged to serve all your catalog pages through Hazel, you are required to do this if you disable cookies.

EMAIL_HEADERS

The EMAIL_HEADERS field allows you more control over the headers used in order invoices. If set to "-1", everything before the first blank line in an email template will be considered a mail header. If it is set to "1", then ALL mail headers (including "To" and "Subject"!) must be given in the mail template.

MISSING_SKUID_MSG

When Hazel cannot find a requested SKUID in her products file, she assigns it a dummy name and price and sets its quantity to 0. You may edit MISSING_SKUID_MSG to change that dummy name. "%s" in the value will be replaced with the missing SKUID. For example, if a shopper requested a product "bong", and you were not selling bongs in your catalog, and had the message set to (No such item: %s), the "bong" would show up as "(No such item: bong)" in the checkout screen.

This feature was added primarily to catch typos on the part of the shopkeeper. In previous versions of Hazel, the product would simply not show up in the item list, which could lead the shopkeeper to believe Hazel was b0rken, when she just couldn't find what you mistyped.

QUIET_ADD

Usually, when an ADD action is performed, the view template is displayed, showing all the items thus far chosen by our valued shopper.

If QUIET_ADD is set to 1, no new page will be loaded. This is accomplished by sending a special message to the shopper's browser. Browsers which do not support this message will display a page informing them that the item was added. At the time of this writing, Microsoft Internet Explorer v3.01, notably, does not support this feature. This multi-billion-dollar corporation has been notified of their flawed software and we expect them to listen to the mighty ten-dollar Netsville juggernaut any day now and adhere to the HTTP standard.

Alternately, you may enter a URL as the value of QUIET_ADD. That URL will be accessed rather than loading the view template. An interesting implementation of this feature is to play a sound when an item is added, and a "cha-ching" cash register sound is included with the Hazel distribution so you can play with the magic of multimedia.

If you intend to set QUIET_ADD to 1, it's a good idea to make it clear to your shoppers that nothing is supposed to happen when the add link is clicked or the form submitted. You might even use JavaScript to display a prompt or message when they click.

Sample Values

  1. QUIET_ADD:1 # Shh.
  2. QUIET_ADD:0 # Load the view template.
  3. QUIET_ADD:http://secure.netsville.com/swank/chaching.wav # Let's hear those cash registers. All together now!
REDIRECT_HASHES

Hazel will allow you to position within files she serves by using the standard "URL fragment" syntax (eg. foo.html#anchor). This will work fine for links, but if you are serving through a form submit (eg. SUBMIT_ACTION_SERVE_foo.html#anchor), Hazel will have to ask your browser to redirect and reposition. If you plan to use "#" within submit actions, set REDIRECT_HASHES to 1

Note: A browser chops off the # and everything after it, then does the positioning itself. Hazel cannot tell a browser what part of a document to display. Some browsers don't support URL fragments at all. Furthermore, browsers are not obligated to support URL fragments in redirections. In short, don't count on this working for all browsers.

REMEMBER_HOSTS

If this option is set, Hazel will attempt to remember shoppers based on their Internet address (and browser type). The information is stored in a binary file (addr.db) in the users directory. Hazel uses this file as a final effort of determing who is accessing the catalog. If cookies are disabled and the client identification number is not passed to Hazel, this is her only hope.

Instead of changing this field, it's usually best to just set CLIENT_MEMORY to "any". This will give Hazel her best chance of remembering the shopper.

SECURE_ACTION

By default, when the shopper requests to be switched to secure mode, Hazel attempts to reload the current action through the secure server. If SECURE_ACTION is set to a Hazel action, she will load that action instead. A common value is "CHECKOUT", since that's where the bulk of user data entry takes place. Setting this field will not cause Hazel to switch to secure mode whenever the designated action is performed.

TRUST_GROUP
TRUST_OTHER

If these fields are set true, Hazel will change the permissions of the files she writes (the orders file and user files) to be readable and writable by the group to which her CGI belongs or by everyone.

Warning: Obviously, allowing your files to be written to and read by anyone but yourself is a bad idea. These fields are provided only as tools for those who know the risks. A much better alternative is to ask your sysadmin to make your hazel.cgi file "setuid" as your user, so that all her files remain owned by and restricted to your login ID.

UNSELECTED_QUANTITY

UNSELECTED_QUANTITY tells Hazel what to use as a value for the quantity of an item which the user has not selected. If unset, she will use "0". If set to "blank", she will use "" (null, nothing, empty string). You could set it to "1" if you wanted products laid out in a form to begin as selected.

Hazel ignores incoming products with an empty "blank" quantity. If they've already been selected, the quantity is unchanged. Consequently, an INPUT field with a VALUE="" tells Hazel to just leave the product alone unless the shopper has changed its default value.

USER_FILE_AGE

If a shopper wanders away from your catalog, Hazel will "remember" them for a certain period of time, greeting them when they return and escorting them to the page they last visited. USER_FILE_AGE tells her how long to remember someone (in days) before tossing their cookies, clearing them from her address book, and getting on with her life. Men!

Sample Values

  1. USER_FILE_AGE:1 # A day.
  2. USER_FILE_AGE:7 # A week.
  3. USER_FILE_AGE:356 # A year.
WEIGHT_UNITS

If you are using WEIGHT fields in your products file, set WEIGHT_UNITS to the base unit used (eg. "ounces", "pounds", "grams").


Getting Started HZML Rules Extras Advanced Reference
Download
Walkthrough
Configuration
The Products File
Order Reporting
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