Now we'll learn how to create and use a macro. We'll use the same HTML we used before to display the sdMacros logo, but this time we'll define a macro with an argument to change its style (size, position, etc.). At the beginning of this article is the command {sdInclude logos/}. The included article contains the following:

{sdDefine logo-sdMacros style}<img src="plugins/content/logos/logo-sdMacros.1-210x70-p25.png" alt="sdMacros Logo" title="sdMacros Logo" style="vertical-align: middle; {sdArg style/}" align="middle" />{/sdDefine}

The sdDefine command defines a macro named "logo-sdMacros" with one argument, style. Notice the {sdArg style/} command embedded in the sdDefine command. The sdArg command will be replaced with the style argument when the macro is used.

sdMacro LogoTo use the macro we use the sdMacro command. For example, the command {sdMacro logo-sdMacros width:75px/} in this sentence produces the sdMacro Logo logo and the command {sdMacro logo-sdMacros float:right/} at the beginning of this paragraph produced the larger logo to the right of this paragraph.

 

Go to the Advanced Commands page to learn to use the sdComment command, pass long arguments into macros with the sdValue command, force text output with the sdEcho command, and change the behaviour of commands with command flags.