NAME

BSE templates documentation


SYNOPSIS

What's a template, what can you do.


DESCRIPTION

With BSE, templates define all the visual aspects of your site.


BASICS

BSE templates use 3 basic types of tag:

There are also the <:wrap ... :> and <:embed ... :> tags, which are described under WRAPPING and Embedding tags respectively.

Data tags

Data tags give you access to the data items that are defined on the current page, many of these tags include parameters so you can select the particular item to display.

A data tag typically looks like:

 <: name arguments :>

In some rare cases they can also include formatting information:

 <: name arguments |formatting:>

Some data tags are context senstive, for example a level2 tag is only usable inside an <:iterator begin level2 :> ... <:iterator end level2:> block.

Some data tags simply provide formatting, for example the <:money:> tag in the shop pages formats a price as a money value.

Conditional tags

Conditional tags let you choose to display different tags depending on a condition. Note that the condition names must already be defined for the page, you cannot test on general conditions.

Each condition tag has two forms:

short form
  <:ifName:>I<true-text><:or:>I<false-text><:eif:>
long form
  <:if Name:>I<true-text><:or Name:>I<false-text><:eif Name:>

Note that for the short form, there cannot be a space between "if" and the name of the condition, while the long form requires the space.

You must always use the long form if there is another conditional tag in the true-text or false-text.

In the tag documentation below you will find two types of tags that can be used as condition names:

Iterator tags

Iterator tags step through a list of items, often articles, and repeats the content for each item in the list. There is usually some data tag that gives access to the current item in the list.

An iterator tag can have two forms:

If the separator is present, then the copies of repeated-content are separated by separator.


SOLUTIONS

A home page with article bodies

See Embedding multiple levels

Complete articles appearing within others

Make sure you have:

  <:embed start:>

and:

  <:embed end:>

surrounding that part of the article you want embedded in the parent.

If you don't want the child article embedded at all, then:

Tags are not being replaced

If you find a tag is not being replaced, you most likely have either a nesting problem on the tag, or a spelling error, for example:

  <:if UnderThreshold:>
  <:or UnderThreshold:>
  <:eif UndreThreshold:>

won't be replaced, since the closing tag has the wrong name.

Also it's not just for matching, sticking with UnderThreshold:

  <:if UndreThreshold:>
  <:or UndreThreshold:>
  <:or UndreThreshold:>

will be kept as-is on your page, since there is no matching tag.

Another possibility for embedded pages is incorrect nesting of the <:embed start:> ... <:embed end:> tags and other tags, for example:

    <:if UnderThreshold:>
    <:embed start:>
    ...
    <:or UnderThreshold:>
    ...
    <:eif UnderThreshold:>
    <:embed end:>

You would end up with spurious <:or UnderThreshold:> and <:eif UnderThreshold:> tags when the article is embedded.

Producing a side-menu of children

The normal menu tags can currently only produce a menu starting from the top of the article tree.

The way to do this is to use the <: iterator ... children :> tag:

  <:iterator begin children:>
   <a href="<:url child:>"><:child title:></a><br>
  <:iterator end children:>

Of course, you might want to include reordering tags too:

  <:iterator begin children:>
   <a href="<:url child:>"><:child title:></a><:moveUp:><:moveDown:><br>
  <:iterator end children:>

Unfortunately, this will include articles which are marked not to appear in menus, so you might want to use:

  <:iterator begin children:>
   <:if InMenu child:>
    <a href="<:url child:>"><:child title:></a><:moveUp:><:moveDown:><br>
   <:or InMenu:><:eif InMenu:>
  <:iterator end children:>


WRAPPING

Wrapping can be used by your templates to simplify creating a single look for your site.

You can create a basic template than includes only content and formatting specific to that content, and then wrap that with a template that includes the top, side and bottom bars for your site, with normal tag substitution occurring in the new composite template.

This also allows you to design the whole base template without having to deal with small parts of the layout, which a component based system may force you to.

You need two tags to wrap one template with another:

  1. Insert "<:wrap wrapper:>" at the top of the template to be wrapped around, where wrapper is the name of a template in the template directory. This should include the .tmpl if any.

  2. Put "<: wrap here :>" the template file specified above, at the location where the calling template should be inserted.

The wrapping template may also include a <:wrap wrapper:> tag, in which case the template is wrapped again. This can be repeated several times (there is a limit to prevent self-recursion using all of memory.)


EMBEDDING

From BSE 0.10 the embed tag can now embed any article, including articles specified by their id, and possibly using other than their normal template. If can understand this section you should be able to apply that to embedding other articles.

Embedding allows you to embed the contents of child articles within the display of the current article. This can be used on a home page to present short (or long) current articles, or to simply present all articles within a section inline, when there are few enough articles that a simple index is just too short.

All article embedding is controlled by the templates. If you find that you're are getting all of the layout of a child page embedded into the parent page, then it's a template problem, not an article data problem.

Embedding tags

To embed the current child article (within an <<:iterator begin ... end>:> block), use:

  <:embed child:>

This will be replaced by the rendered content of the child article.

Of course, in most cases you don't want the entire child article rendered within the parent. To limit the content that is embedded within the parent use:

   <:embed start:>
    I<embedded-content>
   <:embed end:>

You can also test within the template as to whether or not the current article is being embedded with another article:

   <:if Embedded:>
    I<rendered-if-embedded>
   <:or Embedded:>
    I<only-if-not-embedded>
   <:eif Embedded:>

Of course, if you put the <:embed start:> ... <:embed end:> tags within the rendered-if-embedded text then the content displayed for the embedded article can be completely different from when the article isn't embedded.

Controlling embedding

Each article includes a threshold which can be used with the <:if UnderThreshold:> conditional tag to decide whether or not to embed child articles.

For example a section page might have:

  <:if UnderThreshold :>
   <!-- embed the children -->
   <:iterator begin children:>
   <:embed child:>
   <:iterator separator children:>
   <hr>
   <:iterator end children:>
  <:or UnderThreshold:>
   <!-- summarize the children -->
   <:iterator begin children:>
    <p><b><a href="<:url child:>"><:child title:></a></b></p>
    <p><:summary:></p>
   <:iterator separator children:>
   <br>
   <:iterator end children:>
  <:eif UnderThreshold:>

Embedding multiple levels

To maintain the association between a level of your site and the type of content it contains, eg. that articles are at level 3, you can have one level embed within another, that then embeds with the level above that.

This allows you to have the look of having level 3 items directly within level 1 items without having to mix templates between levels.

To do this:

  1. Create a level 1 template that includes the following:

      <:iterator begin children:>
      <:embed child:>
      <:iterator end children:>

    You will want to include extra formatting :)

    Note that this child iterator will only include a single level2 article.

  2. Create a level2 template that contains:

      <:embed start:>
      <:iterator begin children:>
      <:moveUp:><:moveDown:>
      <:embed child:>
      <:iterator end children:>
      <:embed end:>

    You may want to include extra formatting within the child iterator.

    You may also want to use thresholds to choose whether to include the article content or a summary and link:

      <:embed start:>
      <:if UnderThreshold:>
       <:iterator begin children:>
       <:moveUp:><:moveDown:>
       <:embed child:>
       <:iterator end children:>
      <:or UnderThreshold:>
       <:iterator begin children:>
       <p><b><a href="<:url child:>"><:child title:></a></b></p>
       <:summary:>
       <:iterator end children:>
      <:eif UnderThreshold:>
      <:embed end:>
  3. Create the level 1 article that will include multiple levels, and set it's template to the template you created in step 1.

    You could also modify an existing article.

  4. Create the level 2 article, settings it's parent to the level 1 article you created in step 3 and using the template you created in step2.

    Set the "List article" option of this level 2 article to "In sections, but not menu".

So now if you add new level 3 articles to your level 2 article above, they will appear inline to the level 1 article.


TEMPLATE LOCATIONS

In general, page templates can be kept in any directory under the configured $TMPLDIR, but the article editing pages look for templates in certain locations, and some template names are special:

The article administration interface displays lists of articles based on the level of the article, and in some cases the type of article.

The templates for normal articles are kept in 2 places, the common directory and the a numbered directory based on the level of the article, eg. level 1 templates can also be found in directory 1 under the template root.

Template names for shop catalog pages can be any .tmpl file in the catalog directory or catalog.tmpl.

Template names for products can be any .tmpl file in the products directory or shopitem.tmpl.

The templates used for editing articles are kept in admin/edit_level.tmpl, you shouldn't need to modify these, unless you need to limit what your site administrators can do.

The home article is also presented with index.tmpl as a choice, if it's present, and it's child is presented with index2.tmpl as a choice if it's present.


TAG REFERENCE

Tags are documented without the <: and :>.

If a tag is documented as <iterator ...name > then it's an iterator tag and can be used:

  <:iterator begin I<name>:>
   I<repeated-text>
  <:iterator separator I<name>:>
   I<repeated-text>
  <:iterator end I<name>:>

Some tags have a which parameter. For these tags which can be any other tag which is valid for the current page which retrieves article or product attributes, such as section, parent or article itself.

Common Tags

These tags can be used anywhere, including in admin templates. It's possible some admin code has been missed, if you find a place where these cannot be used let us know.

kb data tag

Formats the give value in kwhatevers. If you have a number that could go over 1000 and you want it to use the 'k' metric prefix when it does, use this tag. eg. <:kb file sizeInBytes:>

date data tag
date "format" data tag

Formats a date or date/time value from the database into something more human readable. If you don't supply a format then the default format of "%d-%b-%Y" is used ("20-Mar-2002").

The format is a strftime() format specification, if that means anything to you. If it doesn't, each code starts with % and are replaced as follows:

%a

abbreviated weekday name

%A

full weekday name

%b

abbreviated month name

%B

full month name

%c

"preferred" date and time representation

%d

day of the month as a 2 digit number

%H

hour (24-hour clock)

%I

hour (12-hour clock)

%j

day of year as a 3-digit number

%m

month as a 2 digit number

%M

minute as a 2 digit number

%p

AM or PM or their equivalents

%S

seconds as a 2 digit number

%U

week number as a 2 digit number (first Sunday as the first day of week 1)

%w

weekday as a decimal number (0-6)

%W

week number as a 2 digit number (first Monday as the first day of week 1)

%x

the locale's appropriate date representation

%X

the locale's appropriate time representation

%y

2-digit year without century

%Y

the full year

%Z

time zone name or abbreviation

%%

just '%'

Your local strftime() implementation may implement some extensions to the above, if your server is on a Unix system try running "man strftime" for more information.

bodytext data tag

Formats the text from the given tag in the same way that body text is.

ifEq data1 data2

Checks if the 2 values are exactly equal. This is a string comparison.

The 2 data parameters can either be a tag reference in [], a literal string inside "" or a single word.

ifMatch data1 data2

Treats data2 as a perl regular expression and attempts to match data1 against it.

The 2 data parameters can either be a tag reference in [], a literal string inside "" or a single word.

cfg section key
cfg section key default

Retrieves a value from the BSE configuration file.

If you don't supply a default then a default will be the empty string.

release

The release number of BSE.

add number number ...

Returns the sum of all of the numbers provided. You can use the [tag ...] construct to insert the values of other tags.

concatenate string string ...

Returns the concatenation of all of the strings provided. You can use the [tag ...] construct to insert the values of other tags.

match string regexp output default
match string regexp output
match string regexp

Matches regexp against the given string, if the match does not succeed then default is returned.

On match $digit in output is replaced with the text matched by the digitth set of parentheses in the pattern. Only $1 through $9 is replaced, there is no support for $10 and so on. $$ is replaced with $.

regexp and output should not be user supplied strings.

replace string regexp with global
replace string regexp with
replace string regexp

Replaces the first instance of regexp in string with with where $digit in with is replaced as for the match tag. with defaults to $1.

If global is present and non-zero then every instance of regexp is replaced.

regexp and with should not be set to user supplied strings.

lc string
uc string
lcfirst string
ucfirst string

Does the same thing as the corresponding perl function, lowercasing string, uppercasing string, lowercasing the first letter of string and upper-casing the first letter of string respectively.

capitalize string

Converts the first letter of every word in string to uppercase.

iterator ... cfgsection "section" sort-parameters
cfgentry field

Iterates over the key definitions in a section of the configuration file. Possible values for field are key or value. The section name must be quoted with double quotes.

help file entry
help file entry style

Inserts a help icon in the text. By default this will link to /help/topic.html#entry, but this can be modified by the configuration depending on the style. The default style is "user".

Dynamic Tags

These can be used on any dynamically generated page.

script

The CGI SCRIPT_NAME value

cgi field

Extracts the value of the given CGI field. If more than one value is supplied for the CGI field then all values are returned with spaces between them.

old field func args

Returns the CGI parameter field if supplied, otherwise calls tag func with args as arguments and returns that value.

This is meant to be used as the value="" parameter in input tags.

oldi field index func args

Returns the indexth CGI value named field. If that doesn't exist then tag func is called with args and returns that value.

user field

A field from the currently logged in user if any.

ifUser

Test if there is a user logged on.

ifUserCanSee which

Check if the currently logged on user can see the given article.

iterator ... dynlevel1s
dynlevel1 field

Iterate over visible level 1 articles.

iterator ... dynlevel2s
dynlevel2 field

Iterate over visible level 2 articles that are children of the current dynlevel1.

iterator ... dynlevel3s
dynlevel3 field

Iterate over visible level 3 articles that are children of the current dynlevel2.

iterator ... dynallkids_of
dynofallkid field

Iterate over visible children and stepchildren of the given articles.

iterator ... dynchildren_of
dynofchild field

Iterate over visible direct children of the given articles.

iterator ... dyncart
dyncartitem field

Iterate over the user's shopping cart. dyncartitem fields include units, options, extended and all product fields.

dyncarttotalcost

Total cost off all items in the user's shopping cart, in cents.

dyncarttotalunits

Total number of items in the user's shopping cart.

ifUserMemberOf groupname

Test if the given user is a member of a given user group.

Base tags

These tags can be used in any article, catalog, product or pre-generated template, such as the checkout or search template.

ifAdmin

Conditional tag, true if generating in admin mode.

iterator ... level1

Iterates over the listed level 1 articles.

level1 name

The value of the name field of the current level 1 article.

iterator ... level2

Iterates over the listed level 2 children of the current level 1 article.

level2 name

The value of the name field of the current level 2 article.

ifLevel2 name

Conditional tag, true if the current level 1 article has any listed level 2 children.

iterator ... level3

Iterates over the listed level 3 children of the current level 2 article.

level3 name

The value of the name field of the current level 3 article.

ifLevel3 name

Conditional tag, true if the current level 2 article has any listed level 3 children.

url which

Returns a link to the specified article . Due to the way the action list is built, this can be article types defined in derived classes of Generate, like the parent article in Generate::Article.

money data tag

Formats the given value as a monetary value. This does not include a currency symbol. Internally BSE stores monetary values as integers to prevent the loss of accuracy inherent in floating point numbers. You need to use this tag to display any monetary value.

ifInMenu which

Conditional tag, true if the given item can appear in a menu.

titleImage imagename text

Generates an IMG tag if the given imagename is in the title image directory (titles in the configured image directory). If it doesn't exists, produces the text.

embed which
embed which template
embed which template maxdepth
embed child

Embeds the article specified by which using either the specified template or the articles template.

In this case which can also be an article ID.

template is a filename relative to the templates directory. If this is "-" then the articles template is used (so you can set maxdepth without setting the template.) If template contains a $ sign it will be replaced with the name of the original template.

If maxdepth is supplied and is less than the current maximum depth then it becomes the new maximum depth. This can be used with ifCanEmbed.

embed start ... embed end

Marks the range of text that would be embedded in a parent that used embed child.

ifEmbedded

Conditional tag, true if the current article is being embedded.

Article tags

article name

Access to fields of the article. See Article attributes.

parent name

Access to fields of the parent article. See Article attributes.

ifParent

Conditional tag, true if there is a parent.

section name

Access to the fields of the section containing the article. See Article attributes.

title which

The title of the article presented as an image if there is a titleImage or as text. See Tag notes for values for which.

ifTitleImage which

Conditional tag, true if the given article has a titleImage,

thumbnail which class

The thumbnail image as an <img> tag for object which where which is one of the article objects defined. The optional class adds a class attribute to the tag with that class.

ifThumbnail which

Conditional tag, true if the article specified by which has a thumbnail.

ifUnderThreshold
ifUnderThreshold stepkids
ifUnderThreshold allkids

Conditional tag, true if the number of children/stepkids/allkids is less or equal to the article's threshold.

body

The formatted body of the article.

You can use the following formatting within the body of an article:

a[url,title]
link[url|title]

Inserts a link with title that points to url.

b[text]

The text is formatted in bold.

i[text]

The text is formatted in italics.

align[position|text]

The text is formatted as a paragraph aligned to the left, right or center (not the US spelling of center).

font[size|text]

Formats the text at the given size, a number from 1 to 7, or a relative size like -2 or +1.

hr[width|height]

Inserts a horizontal rule. Width is either in pixels ("100") or a percentage ("50%"). Height should be in pixels. If either is omitted the HTML or style-sheet default is used.

anchor[name]

Creates a local link target called name. Use link[#name|title] to link to it.

table[options\nrows...\n]

Formats a table. Options are either | separated table width, bgcolor, cellpadding, font size and font face, or raw html table attributes.

Each row is a single line:

  options|column 1|column 2 ...

Where the options are raw HTML tr attributes.

An example:

 table[
 |b[x]|b[x*x]
 |1|1
 |2|4
 |3|9
 ]
table[options|text]

Formats a single cell table. The options can be either | separated values as for the multi-line table[] tag, or raw HTML table options.

  table[80%|#FF8080|Hello]
  • The text is formatted with bullets. Eg.

      ** This will have a bullet at the left
      ** So will this.
  • ## text

    The text is formatted as part of a numbered list:

     ## the first line
     ## the second line

    is presented as:

     1.  the first line
     2.  the second line
    embed[which]
    embed[which,template]

    Embeds the article given by which, which may be a symbolic name like "section" or an article id as a number.

    Make sure you don't create a loop where an article embeds itself or embeds another article that embeds the current article (or bigger loops). This is handled with an error message in the page.

    iterator ... crumbs [option]

    Iterates over the ancestors of the article. See the item crumbs.

    option can be empty, "listedonly" or "showtop". If empty the display of an unlisted level1 ancestor is controlled by $UNLISTED_LEVEL1_IN_CRUMBS, if "listedonly" then an unlisted level1 article isn't shown in the crumbs, and it is if "showtop" is the option. This can be used in <: ifCrumbs :> too.

    crumbs name
    crumb name

    Access to the fields of the specific ancestor. name can be any of the Article attributes. crumbs is now deprecated, use crumb where possible.

    ifCrumbs

    Conditional tag, true if there are any crumbs.

    ifChildren

    Conditional tag, true if the article has any children.

    iterator ... children

    Iterates over the children of the article. See the item child.

    child name

    Access to the fields of the current child.

    summary

    Produces a processed summary of the current child's body.

    ifPrevChild

    Conditional tag, true if there is a previous child. Originally used for generating a move up link, but you can use the moveUp tag for that now.

    ifNextChild

    Conditional tag, true if there is a next child. Originally used to generating a move down link, but you can use the moveDown tag for that now.

    embed child

    This has been made more general and been moved, see embed in the Generate manpage.

    ifCurrentPage which

    Conditional tag, true if the given which is the page currently being generated. This can be used to apply special formatting if a level1 or level2 article is the current page.

    iterator ... images

    Iterates over the unnamed images for the given article.

    iterator ... images all

    Iterates over all images for the article.

    iterator ... images named

    Iterates over the named images for the article.

    iterator ... images named /regexp/

    Iterates over images with names matching the given regular expression. Note that if the expression matches an empty string then unnamed images will be included.

    image which field

    Extracts the given field from the specified image.

    which in this can be either an image index to access a specific image, or "-" to access the current image in the images iterator.

    The image fields are:

    articleId

    The identifier of the article the image belongs to.

    image

    A partial url of the image, relative to /images/.

    alt

    Alternative text of the image.

    width
    height

    dimensions of the image.

    url

    the url if any associated with the image

    image which align
    image which
    image

    Produces HTML to render the given image.

    which can be an image index (1, 2, 3...) to select one of the images from the current article, or '-' or omitted to select the current image from the images iterator. If align is present then the align attribute of the image is set.

    If the image has a URL that <a href="...">...</a> will also be generated.

    ifImage imageindex

    Condition tag, true if an image exists at the given index.

    ifImages
    ifImages all

    Conditional tag, true if the article has any images.

    ifImages named

    Conditional tag, true if the article has any named images.

    ifImages named /regexp/

    Conditional tag, true if the article has any named images, where the name matches the regular expression.

    ifImages unnamed

    Conditional tag, true if the article has any unnamed images.

    thumbimage geometry image
    thumbimage geometry image field
    gthumbimage geometry image
    gthumbimage geometry image field

    Inserts a thumbnailed version of the given image, or a field from the image if the field parameter is supplied.

    image can either be an image name, '-' for the current image in the images or gimages iterator or an image number for thumbimage.

    ifDynamic

    Tests if the article is dynamically generated.

    ifAccessControlled
    ifAccessControlled which

    Tests if the article is access controlled.

    top field

    Toplevel article being generated. This is the page that any articles are being embedded in.

    iterator ... files

    Iterates over the files attached to the article, setting the file tag.

    file field

    Information from the current file in the files iterator.

    The file fields are:

    The following tags produce output only in admin mode.

    admin

    Produces buttons and links used for administering the article.

    This tag can use a specialized template if it's available. If you call it with a parameter, <:admin template:> then it will use template admin/adminmenu/template.tmpl. When used in an article template <:admin:> behaves like <:admin article:>, when used in a catalog template <:admin:> behaves like < <:admin catalog: >>, when used in a product template <:admin:> behaves like <:admin product:>. See Admin Menu Templates for the tags available in admin menu templates.

    If the template doesn't exist then the old behaviour applies.

    moveUp

    Generates a move up link if there is a previous child for the current child.

    moveDown

    Generates a move down link if there is a next child for the current child.

    Catalog tags

    iterator ... products

    Iterates over the products within this catalog.

    product field

    The give attribute of the product.

    ifProducts

    Conditional tag, true if there are any normal child products.

    iterator ... allprods

    Iterates over the products and step products of this catalog, setting the allprod tag for each item.

    allprod field

    The given attribute of the product.

    ifAnyProds

    Conditional tag, true if there are any normal or step products.

    iterator ... stepprods

    Iterates over any step products of this catalog, setting the stepprod tag to the current step product. Does not iterate over normal child products.

    stepprod field

    The given attribute of the current step product.

    ifStepProds

    Conditional tag, true if there are any step products.

    iterator ... catalogs

    Iterates over any sub-catalogs.

    catalog field

    The given field of the current catalog.

    ifSubcats

    Conditional tag, true if there are any subcatalogs.

    admin

    Generates administrative tools (in admin mode).

    Product tags

    You can use any article tags as well.

    product field

    Access to product fields of the product being rendered. This is the same as the article field tag for normal articles, but also give you access to the product fields.

    admin

    Produces product specific administration links in admin mode.

    iterator ... options

    Iterates over the options available for the product, setting the option tag.

    option popup

    The popup list of values for the current option.

    option field

    Retrieves the given field from the option. Most commonly you just want the desc field.

      <:if Options:>
      <!-- you might want to start a table here -->
      <:iterator begin options:>
      <:option desc:>: <:option popup:>
      <:iterator end options:>
      <!-- and end a table here -->
      <:or Options:><:eif Options:>
    iterator ... stepcats

    Iterates over any step parents of the product, setting the stepcat for each element.

    stepcat field

    Access to fields of the step catalogs of the parent.

    ifStepCats

    Conditional tag, true if the product has any step catalogs.

    Search tags

    These tags are used on the page generated by search.pl, and are found in search_base.tmpl.

    Please note that these tags are replace once the actual search is done. The tags defined in Base tags in the templates manpage are replaced when you choose Generate static pages from the admin page.

    iterator ... results

    Iterates over the articles for the current page of results.

    article field

    Access to fields in the current search result article.

    date which field

    Formats the given field of the tag which for display as a date.

    keywords

    Keywords for the current result article, if any keywords matches the requested search.

    ifResults

    Conditional tag, true if the search found any matching articles.

    ifSearch

    Conditional tag, true if the user entered any search terms.

    dateSelected datevalue

    The date value chosen by the user for the last search. Used in a <select> HTML tag to have the date field select the last value chosen by the user.

    excerpt

    An excerpt of the body of the current search result, with search terms highlighted.

    articleurl

    A link to the current search result article, taking admin mode into account.

    count

    The total number of matches found.

    ifMultiple

    Conditional tag, true if more than one match was found. This can be used to improve the wording of descriptions of the search results.

    terms

    The entered search terms.

    resultSeq

    The number of the current search result (ie. the first found is 1, etc).

    list

    A drop-down list of searchable sections.

    iterator ... pages

    Iterates over page numbers of search results.

    page

    The current page number within the page number iterator.

    ifCurrentPage

    Conditional tag, true if the page in the page number iterator is the displayed page of search results. This can be used for formatting the current page number differently (and not making it a link.)

    pageurl

    A link to the current page in the page number iterator.

    An example

     ...
     <input type=text name=s value="<:terms:>">
     ...
     <:if Search:>
     <:if Results:>
      <dl>
      <:iterator begin results:>
      <dt><:resultSeq:> <a href="<:article url:>"><:article title:></a>
      <dd><:excerpt:>
      <:iterator end results:>
      </dl>
      <:iterator begin pages:>
       <:if CurrentPage:>
        <b><:page:></b>
       <:or CurrentPage:>
        <a href="<:pageurl:>"><:page:></a>
       <:eif CurrentPage:>
      <:iterator separator pages:>
      |
      <:iterator end pages:>
     <:or Results:>
     No articles matches your search.
     <:eif Results:>
     <:or Search:>
     <:eif Search:>

    Cart page

    iterator ... items

    Iterates over the items in the shopping cart, setting the item tag for each one.

    item field

    Retreives the given field from the item. This can include product fields for this item.

    index

    The numeric index of the current item.

    extended
    extended field

    Produces an extended price, ie. the given field of the curren cart item times the number of units. The default field is the unit price. This should be formatted using the money tag.

    money which <field>

    Formats the given field as a money value (without a currency symbol.)

    count

    The number of items in the cart.

    Checkout tags

    This has the same tags as the Cart page, and some extras:

    total

    The total cost of all items in the cart.

    This will need to be formatted as a money value with the money tag.

    message

    An error message, if a validation error occurred.

    old field

    The previously entered value for field. This should be used as the value for the various checkout fields, so that if a validation error occurs the user won't need to re-enter values.

    delivery_in

    An estimate in days for delivery. May look like "1" or "1 or 2" if it is available at all.

    shipping_cost

    The cost of shipping by the selected shipping_method, if available.

    shipping_method

    The selected shipping_method, if any.

    Completed order

    These tags are used in the checkoutfinal_base.tmpl.

    item field
    product field

    This is split out for these forms.

    order field

    Order fields.

    You can also use "|format" at the end of a field to perform some simple formatting. Eg. <:order total |m6:> or <:order id |%06d:>.

    m<number>

    Formats the value as a <number> wide money value.

    %<format>

    Performs sprintf() formatting on the value. Eg. %06d will format 25 as 000025.

    Mailed order tags

    These tags are used in the emails sent to the user to confirm an order and in the encrypted copy sent to the site administrator:

    iterate ... items

    Iterates over the items in the order.

    item field

    Access to the given field in the order item.

    product field

    Access to the product field for the current order item.

    order field

    Access to fields of the order.

    extended field

    The product of the field in the current item and it's quantity.

    money tag parameters

    Formats the given field as a money value.

    The mail generation template can use extra formatting specified with '|format':

    m<number>

    Format the value as a number wide money value.

    %<format>

    Performs sprintf formatting on the value.

    <number>

    Left justifies the value in a number wide field.

    The order email sent to the site administrator has a couple of extra fields:

    cardNumber

    The credit card number of the user's credit card.

    cardExpiry

    The entered expiry date for the user's credit card.

    Admin Menu Templates

    These tags can be used in the templates included by the <:admin:> tag.

    The basic template tags and ifUserCan tag can be used in admin menu templates.

    article field

    Retrieves a field from the current article.

    parent field

    Retrieves a field from the parent of the current article.

    ifParent

    Conditional tag, true if the current article has a parent.

    ifEmbedded

    Conditional tag, true if the current article is embedded in another article, in this context.

    Article attributes

    id

    Identifies the article.

    parentId

    The identifier of the parent article.

    title

    The title of the article. See the title tag

    titleImage

    The name of the title image for the article, if any. See the title and ifTitleImage tags.

    body

    The body of the article. See the body tag.

    thumbImage
    thumbWidth
    thumbHeight

    The thumbnail image for the article, if any. See the thumbnail tag.

    release
    expire

    The release and expiry dates of the article.

    keyword

    Any keywords for the article. Indexed by the search engine.

    link
    admin

    Links to the normal and adminstrative versions of the article. The url tag defined by Generate.pm will select the appropriate tag for the current mode.

    threshold

    The maximum number of articles that should be embeded into the current article for display. See the ifUnderThreshold tag.

    summaryLength

    The maximum amount of text displayed in the summary of an article. See the summary tag.

    generator

    The class used to generate the article. Should be one of Generate::Article, Generate::Catalog or Generate::Product.

    level

    The level of the article. Sections are level1, etc

    listed

    How the article is listed. If zero then the article can only be found in a search. If 1 then the article is listed in menus and article contents, if 2 then the article is only listed in article contents.

    lastModified

    When the article was last modified. Currently only used for display in search results.

    lastModifiedBy

    Set the the current admin user logon if access_control is enabled in the cfg.

    created

    Set to the current date time when a new article is created.

    createdBy

    Set to the current admin user logon if access_control is enabled in the cfg.

    author

    A user definable field for attributing the article author.

    pageTitle

    An alternate article title which can be used to make search engine baited oage titles.

    metaDescription

    Article metadata description, used as metadata in the generated HTML output.

    metaKeywords

    Article metadata keywords, used as metadata in the generated HTML output.

    The following attributes are unlikely to be used in a page:

    displayOrder

    Used internally to control the ordering of articles within a section.

    imagePos

    The position of the first image in the body. The body tag will format images into the body as specified by this tag.

    template

    The template used to format the article.

    flags

    Flags which can be checked by code or template tags to control behaviours specific the the article.

    force_dynamic

    Forces a page to be displayed dynamically with page.pl regardless of access control.

    inherit_siteuser_rights

    Controls whether the article inherits its parents access controls.

    Product specific fields

    summary

    An in-between length description of the article for use on the catalog page.

    leadTime

    The number of days it takes to receive the product after it has been ordered.

    retailPrice

    The cost to the customer of the product. You need to use the money tag to format this field for display.

    wholesalePrice

    Your cost. You need to use the money tag to format this field for display.

    gst

    The GST (in Australia) payable on the product.

    Order fields

    id

    The order id or order number.

    delivFirstName
    delivLastName
    delivStreet
    delivSuburb
    delivState
    delivPostCode
    delivCountry

    Delivery information for the order.

    billFirstName
    billLastName
    billStreet
    billSuburb
    billState
    billPostCode
    billCountry

    Billing information for the order.

    telephone
    facsimile
    emailAddress

    Contact information for the order.

    total

    Total price of the order.

    wholesaleTotal

    Wholesale cost of the total. Your costs, if you entered wholesale prices for the products.

    gst

    GST (in Australia) payable on the order, if you entered GST for the products.

    orderDate

    When the order was made.

    Order item fields

    productId

    The product id of this item.

    orderId

    The order Id.

    units

    The number of units for this item.

    price

    The price paid for the product.

    wholesalePrice

    The wholesale price for the product.

    gst

    The gst for the product.

    filled

    Whether or not the order has been filled. This can be used with the order_filled target in shopadmin.pl for tracking filled orders.

    whenFilled

    The time and date when the order was filled.

    whoFilled

    The user who marked the order as filled.

    paidFor

    Whether or not the order has been paid for. This can be used with a custom purchasing handler to mark the product as paid for. You can then filter the order list to only display paid for orders.

    paymentReceipt

    A custom payment handler can fill this with receipt information.

    randomId

    Generated by the prePurchase target, this can be used as a difficult to guess identifier for orders, when working with custom payment handlers.

    cancelled

    This can be used by a custom payment handler to mark an order as cancelled if the user starts processing an order without completing payment.


    BUGS

    Currently, template replacement is done using simple regular expressions, which can be a problem for nested <:if ...:> tags.