VWcms Substitution  
 

[PREV][NEXT]

[PRINT]

Substitution of content for directive is a fundamental mechanism used in the building and dynamic nature of VWcms sites.

The HTML content is parsed by VWcms, with all text other than that surrounded by double dollar symbols (i.e. $$) output as-is.  Dollar-delimited strings are used as substitution directives, and in this sense a form of macro, representing content generated by VWcms and inserted in place of the directive.  Substitution directive names are case-insensitive, though generally shown upper-case to more easily distinguish them from surrounding content.  Some take optional parameters (case sensitivity is dependent on the parameter), each separated by a single delimiting dollar symbol (see examples).  To specify an empty parameter use the sequence $\$.

Substitution is supported in both template and HTML content, using exactly the same directives, with noted exceptions.

Common Directives

The following directives might be expected to be used in general content.

Name Function Parameter
$$AGO$$ How many minutes, hours, days, etc., ago the site or section was modified. (This section was last modified 10 months ago.) "#" for section, "*" (default) for site
$$BACK$$ A (JavaScript-enabled) link to go to the previously viewed page. alternate text
$$BLOG$$ Allows blogging. See Blogging. parameters
$$CGI$$ Insert the value of the supplied parameter CGI variable. CGI variable name
$$COMMENT$$ Display and solicit reader comments.  See Reader Comment. parameters
$$CONTENT$$   The content of the specified section.  See Include Examples. section name/path
$$CRUMBS$$ Breadcrumb-style navigation aid.  See Table of Content.
parameters
$$FORM$$ Construct an HTML form.  See Reader Form. parameters
$$GOTO$$ Redirect to the specified URL. See Go & Gone To. URL
$$GONETO$$ Redirect to the specified URL. See Go & Gone To. URL
$$HIDE$$ No table-of-content entry, no site-map entry, not returned by searches, etc.  See Table of Content. none
$$HIT$$ Section (page) hit counter.  See Hit Counter. parameters
$$HTML$$ Insert raw HTML into the content.  See Raw HTML. parameter
$$INCLUDE$$ Include the contents of the supplied parameter in its own viewport.  See Include & Insert. CSS and URL**
$$INSERT$$ Insert the contents of the supplied parameter in-line with the content.  See Include & Insert.
CSS and URL**
$$LASTMOD$$  The date/time the site or section was last modified. This section last modified Wednesday, 20 July 2011 21:30. "#" for section, "*" (default) for site; second parameter can be a time format string
$$NEXT$$  A link to the next section (if any).  alternate text
$$NOPRINT$$ Section is not printed.  See Print Template. "+" this and subordinate sections
$$NOTOC$$ No entry in the table-of-content but appears in the site-map and is returned by searches, etc.  See Table of Content. none
$$PRAGMA$$ Supply a pragmatic directive.  See Pragma. parameters
$$PREV$$  A link to the previous section (if any).  alternate text
$$QANDA$$ Supports a question and answer challenge.  See Using Q&A. parameters
$$RECAPTCHA$$ Supports the Google reCAPTCHA service.  See Using reCAPTCHA. parameters
$$SHOW$$ Show the parameter.  LANG to show the current language configuration directives.  Code module SHOWLOCAL.C allows local $$SHOW$$s to be provided. parameter
$$SYNOPSIS$$ Display a list of sections with extract. See Synopsis. parameter
$$TEASER$$ Adds a teaser (or informational comment) to the site map.  Does not appear in the content. text
$$TICKET$$ Issues a comment ticket.  See Spam Abuse. none
$$TIME$$  Display current date/time. See Times. parameter
$$TITLE$$ Display the current section title. See Section Title. parameters
$$USER$$ A logged-in username; empty otherwise. supplementary text

**See further explanation below.

Macro Directives

A site may configure substitution macros that can then be used to insert text within the site.  Macros are defined in the VWcms configuration file.  The [macro] configuration directive can be used multiple times to define each macro required.  Two types of macro are supported:

Substitution Insertion
A substitution macro, indicated by a ':' character, occurs when the page is read.  Subsequently changing the value of the macro in the configuration changes the substitution at read time. An insertion macro, indicated by a '=' character, occurs when the page is edited.  Any subsequent change in macro does not affect this instance.

The following are the directives from the Vdub documentation (this site) and are used in the following examples.

[macro]  example1:<b>This is EXAMPLE ONE macro!</b>
[macro]  example2:<b>This is EXAMPLE %s macro!</b>
[macro]  example3=<b>This is EXAMPLE THREE macro!</b>
[macro]  VWcmsBtn:<input class="manage_btn" style="font-size:66%%;margin:1px;" \
type="reset" value="%s" />

These directives are used with names beginning with a single underscore.

$$_example1$$ This is EXAMPLE ONE macro!

Macros can use the sequence %s to insert parameters when used.  Percent symbols must be escaped by doubling-up (i.e. %%).

$$_example2$TWO$$ This is EXAMPLE TWO macro!

This text of the example3 macro was inserted at edit time.

This is EXAMPLE THREE macro!

Note the error indication in the following example because the macro doesn't exist!

$$_example4$$ $$_example4$$

The buttons in use throughout the Vdub documentation are generated using a macro.

$$_VWcmsBtn$A Button!$$

The VWcms Edit interface contains a convenient selector and button for inserting macros.

Specialised Directives

The following directives are not commonly used in content.

Name Function Parameter
$$ADVISE$$ Display informational, warning and error messages generated by the VWcms engine.  Should be one instance somewhere on the site template. none
$$CONTENT$$ The content of the current section. ** none
$$DRAFT$$ When managing the site and a draft is being viewed displays an advisory message. alternate message
$$LOGIN$$ Provide a login/logout dialog. alternate text
$$MANAGE$$ Provide a manage-site/view-site dialog. alternate text
$$RESULT$$ Display the results of a site search. none
$$RESULT$?$$ Display the keyword searched for. none
$$SITEMAP$$ Display a site-map as a nested, ordered list. none
$$TOC$$ Table of Content. See Table of Content. ** As shown to the left.
$$$$ Four dollar symbols output two dollar symbols (substitution-escape). none
$$! ... !$$ Text inside the directive is not output.    Note the delimiting exclamation marks. none

**Site template only.

Alternate Text

Those directives that have an alternate text parameter generally provide visible text or a link in the content of the page.  These have a default string associated with them but allow an alternate to be specified.  This not only allows customisation of the various elements of the page but also allows for non-English language pages to be composed.  There are also a set of configuration directives beginning [lang_...] that can used.

Alternate text, on appropriate substitution directives, may be used to specify graphical icons (images).  For example, the $$PREV$$ and the $$NEXT$$ directives, normally producing

<<PREV   NEXT>>

could be placed in the content as

$$PREV$<img src="/_vdub/arrow_left.gif" border="0" />$$
$$NEXT$<img src="/_vdub/arrow_right.gif" border="0" />$$

which would produce the content

[PREV]   [NEXT]

Detectable Errors

VWcms reports detectable errors in substitution directives and parameters.  The directive is highlighted on the page and the first reported in a status area. It also uses this area to report other conditions, such as warnings and informationals, in the case of Vdub documentation placed at the bottom of the page (using the $$ADVISE$$ directive).  This is an example of a misspelled directive.

$$ADVIZE$$

There are a number of deliberate errors included throughout the Vdub documentation to illustrate the function.

$$TIME$%d %b %999Y %H:%M$$=$$TIME$%d %b %999Y %H:%M$$

$$BOGUS$$=$$BOGUS$$

[PRINT]  [PRINT]