Free-Conversant Support / How-To Use The Enclosure Macro
 Home   About Conversant   Free Sites   Hosting   Support   XML-RPC 

Search



Documentation >> Outline of How-To Docs >> How-To Use The Enclosure Macro

The #enclosure Macro

The <!--#enclosure--> simple macro allows you to insert (or link to) a variety of enclosures for display in a message. To use it, first attach the file you wish to use to a message. You can then use the macro with this general syntax:

<!--#enclosure filename="<name of enclosure>" msgNum="<message number that contains the enclosure>"-->

Both the filename and msgNum parameters are optional.

If you don't specify a message number, the current message will be assumed. Any additional parameters you include in the simple macro will be used to build the tag that the macro generates. So, for example, to use an image named "rock.jpg" you've enclosed in a message, you might use the macro like this:

If you don't specify a filename, then the message's first attached file will be assumed.

<!--#enclosure filename="rock.jpg" border="5"-->

Conversant would convert the simple macro into the appropriate image tag:

<IMG SRC="http://www.free-conversant.com/support/1/enclosure/rockthumb.jpg" HEIGHT="150" WIDTH="200" border="5"/>

The image tag would, of course, cause the image to be displayed within your web page like so:

rock.jpg

The macro will handle various content in different ways. Further details on the various kinds of files it can deal with follow:

Linking to Enclosures

If you don't want the enclosure to be displayed in the HTML, but would rather just link to the file, you have three optional parameters at your disposal.

  • linkOnly - optional - can be either "true" or "false"

    If this parameter's value is "true", then a link will be built to the enclosure. If it's "false", or if the parameter is omitted, then the enclosure is displayed in-line rather than linked.

    The type of link that is produced depends on the other two optional parameters, as follows.

  • urlOnly - optional - can be either "true" or "false"

    If this parameter's value is "true", then the URL of the enclosure is returned. If it is "false", or if the parameter is omitted, then a full A tag is built to link to the enclosure.

  • linkText - optional - any text

    If this parameter is supplied, then it's value will be used to build the A tag which links to the enclosure.

    If this parameter is omitted, then an A tag is built with the linked text being the name of the enclosure.

Here are examples:

Graphic Files

The #enclosure simple macro recognized three kinds of graphic files: GIF, JPEG, and PNG. For each of these, Conversant automatically determines the appropriate height and width and adds those elements to the tag for quicker rendering.

Plain Text

When rendering plain text files, the macro simply includes the content of the text file wrapped in <PRE> tags for correct display within an HTML page. For example, one might use the enclosure tag this way:

<!--#enclosure filename="textsample.txt"-->

resulting in the following:

Hi there!
I'm a text file with
three lines of text.

HTML

Including HTML files is a trickier business than including text files, as the pages into which you'll be inserting the HTML will already have an <HTML> tag, a <BODY> tag, etc. Therefore, when you insert an HTML file, by default only the information between the <BODY> and the </BODY> tags will be included. E.g.,

<!--#enclosure filename="htmlsample.html"-->

yields this:

This is the HTML test file.

If you have more advanced needs, you can also specify your own matching strings. For example, a Dreamweaver user might choose to ignore the templates that Dreamweaver applies to the pages like so:

<!--#enclosure filename="htmlsample2.htm" startAfter="<!-- #BeginEditable "BODY" -->" endBefore="<!-- #EndEditable -->"-->

(Note that special characters that are passed as parameters here should be entified.) The result of this would then be:

Hi! I'm an HTML test file.

Other Content

Any data that isn't recognized as one of the previous data types will be included using the HTML EMBED tag. For example, to include a Quicktime movie, one might use the following:

<!--#enclosure filename="sample.mov" width="200" height="256" autoplay="false"-->

The resulting HTML would be something like this:

<EMBED SRC="http://www.free-conversant.com/support/1/enclosure/Sample.mov" autoplay="false" height="256" width="200" />

Resulting in the display of the movie like so: (Quicktime plugin required to see the movie.)

View in DG