Overview

Dollar Functions are primarily used to add dynamic content to your website. As a trivial example, if you want to show the current date and/or time on a page, since this information changes constantly, you would use a dollar function to generate this information dynamically.

Internally, dollar functions have access to all of the information available related to your website so they can be very sophisticated but most are very simple to develop and use.

Parameters

Dollar functions theoretically can accept any number of parameters but most only require a small number of parameters. Usually, the critical or required parameters are defined first, followed by optional parameters that are generally defaulted. String parameters do not have to be encased in quotes unless the parameter value contains one or more commas since the comma is used as a parameter separator.

In most cases, you will learn about parameter values by entering the function name on a page, including the trailing brackets (), then placing your cursor on the name and using Crtl + g to get help entering the function parameters. The resulting form will allow you to enter the parameters for the dollar function and, in most cases, test the function output and return the completed dollar function to its container.

Nested Parameters

Dollar functions can be nested to any depth, this can be very useful since it allows parameters to your dollar functions to be supplied by other dollar functions. Consider an example where a layout may embed one of two possible subpages depending on which page is being shown. In this case the layout could include these nested dollar functions:

$page($iparm(subpage,default_subpage))

The iparm function is used to obtain the value of an internal parameter defined for the current page. This function can accept a default to be used when the parameter is not defined for a given page. This nested sequence would embed a subpage called default_subpage except for pages which define an alternate subpage name in their internal parameters.

Postponing Dollar Function Resolution

When dollar functions are used as parameters to other dollar functions, these parameter values are usually resolved (expanded) before calling the container dollar function. Nevertheless, when defining your dollar functions you can indicate that you wish to defer the resolving of parameters until after the dollar function has been processed. It is a good idea to postpone the resolving of parameters in cases where certain parameters will only be used conditionally. For example, the $if function will only process either the true condition or the false condition, never both. Therefore, it is more efficient to delay resolving these parameter until it is known which one will be processed rather than needlessly resolving both in advance.

On rare occasions, you may want to defer the processing of a parameter, even though this is not the default behaviour for the function. This can be achieved by using the string {DOLLAR} instead of the $ sign when referring to the nested function.

Help Index

GenHelm Architecture GenHelm Architecure.
Why GenHelm? Summary of the GenHelm methodology.
Getting Started Learn how to start a new website.
Naming Conventions Naming web pages and other items.
Common Web Page Fields Descriptions of fields that are common to all page models.
Layouts Defining codeframes and layouts.
Styles and Scripts Descriptions of fields that are common to all page models.
Meta Tags How to configure meta tags for your site and specific pages.
Dollar Functions General information about dollar functions.
Navigation Tips Navigation Tips and Techniques
Favourite Icons How to configure favorite icons for your site.
Blog Maintenance Blog and post administration.
Direct Command Help Help for the direct command field.
Programming with GenHelm Writing programs that interact with the GenHelm framework.