decorative banner

Calling a macro from within a macro


    To reduce overall typing work and make your macro files easier to maintain, GoLive's text macro tool lets you reference other macros from within a macro.

    To call another macro from within a macro, you need to enclose the name of that macro in dollar signs ($). The following example shows the proper syntax:

    Macro #1:

        meta-author «<META NAME="author" CONTENT="$author$"»

    Macro #2:

        author "Michael Daeumling"

    Upon insertion of the meta-author macro, GoLive will automatically look for the second macro named "author" and insert its content at the specified location in the first macro. Thus, the resulting text insert would read:

        meta-author <META NAME="author" CONTENT=" Michael Daeumling"

    If calling a second macro produces unexpected results, this may be due to a circular reference. Circular references occur if the second macro contains a reference back to the macro called in the first place. The text macro tool handles those circular references gracefully without entering an endless loop. Rather than that, it will suppress the circular reference and insert the macro name found at the beginning of the macro definition.

    Here is a simple example:

        A "A to $B$"

        B "B to $C$"

        C "B to $A$"

    The resulting text insert would read:

        A to B to C

    As can be seen from the above example, GoLive ignores the circular reference pointing back to macro "A" and inserts the macro name "C" instead.