sdMacros has the following commands:

  • sdInclude - Include another Joomla! article in the current article.
  • sdDefine - Define a macro (command).
  • sdMacro - Use a previously defined macro.
  • sdArg - The value of an sdMacro argument (in an sdDefine command).
  • sdValue - The value of an sdMacro (in an sdDefine command).
  • sdStyle - Define a block of CSS commands.
  • sdComment - A comment - always removed.
  • sdEcho - Echo text. Used when text would otherwise be remove (see noChildTags flag).
  • sdEnable - Enable or disable sdMacros.

The above commands may also contain flags to control command processing.

sdInclude Syntax:

{sdInclude articleId/}

{sdInclude ["]articleName["]/}

  • The sdInclude command includes the text from another article at the position of the command. The article may contain text, HTML, Javascript, etc.
  • The article may be specified either by its Id or by its name. If the name contains spaces it must be surrounded by single or double quotes.
  • It is possible for more than one article in Joomla! to have the same name. If this is the case the article must be specified using its Id.
  • Articles must be published to be included.
  • Articles must have the same or lower privilege level as the current user to be included.

 

 

sdDefine Syntax:

{sdDefine name [argName1] [argName2] ...}macro definition{/sdDefine}

  • The sdDefine command creates a macro named "name"
  • The argument names are used in the macro definition by {sdArg/} commands
  • The {sdArg/} commands will be replaced by the argument values when the command is used with a sdMacro command.

 

 

sdMacro Syntax:

{sdMacro name [arg1] ["][arg2]["] ...}[macro value]{/sdMacro}

  • The sdMacro command inserts the definition of the macro named "name"
  • Any arguments in the macro definition (sdDefine) are replaced with the arguments above.
  • The arguments are separated by white space.
  • If an argument contains white space, it may be surrounded by double-quotes ("). The quotes are not part of the argument.
  • "macro value" is optional and acts as an additional argument typically used for a multi-line value. It replaces and sdValue commands in the macro definition.

     

     

    sdArg Syntax:

    {sdArg name/}

    • The sdArg command is used in a macro definition (in an sdDefine command)
    • name indicates which macro argument to use and the value is taken from that argument in the sdMacro command.

     

     

    sdValue Syntax:

    {sdValue/}

    • The sdValue command is replaced with the value of the current macro.
    • Only used in sdDefine commands.

     

     

    sdStyle Syntax:

    {sdStyle/}

    • The sdStyle command is removed and its value is added as a text/css block to the current page.

     

     

    sdComment Syntax:

    {sdComment}some text{/sdComment}

    • The sdComment command is used to add a comment to a macro definition, include file, etc. Comments are always removed.
    • Comments may be nested, but they can not contain mal-formed comands, e.g. an unterminated sdMacro command.

     

     

    sdEcho Syntax:

    {sdEcho/}some text{/sdEcho}

    • The sdEcho command simply outputs whatever its contents are. It is used when its contents would otherwise be removed. For example, if the childTagsOnly flag is set and text would normally not be shown, sdEcho will make it visible (i.e. will make it a child).
    • Any commands with an sdEcho command will be processed. If this isn't desired use the noProcessCommands flag.

     

     

    sdEnable Syntax:

    {sdEnable 0,1,true,false/}

    • The sdEnable command enables or disables sdMacros.
    • sdEnable commands can be nested. For example, if there are two {sdEnable false/} commands in a row, two {sdEnable true/} commands will be required to re-enable sdMacros.

     

     

    Command Flag Syntax:

    {command[:flag][:flag]... [arguments]/}

    childTagsOnly When processing a command, ingnore anything except the results of any sdMacro commands. This is typically used when an article is inteded to contain only various sdMacro commands. If the article is created in a typical Joomla! text editor it may also contain invisible HTML such as paragraph tags (<p>) around the commands. This can be correct by only editing the article in Joomla!'s "No - editor" editor, or being careful to only use the HTML modes of other editors. Or, it is often easier to use the childTagsOnly flag which removes this extra HTML allowing any of the Joomla! editors to be used.
    noProcessCommands Do not process any commands, leave them as is. This will cause the commands to be visible as normal text. It is typically only in something like a tutorial where the contents of a macro is supposed to be displayed, not executed.

    preserveArgHTML

    Do not convert HTML entities in articles back to HTML. Many of the Joomla! editors will convert certain characters like quotes (" or '), and angle brackets (< or >) into HTML entities (<, >, etc.). The editors do this so the browser isn't confused and interpret them as HTML. But, this translation can cause problems for sdMacros cc, for example a command with a quoted argument such as {sdMacro test "Hello World!"/} because the quotes will be translated to &quote; and sdMacros won't see them. To prevent this sdMacros converts HTML entities back to HTML before processing. But, there are cases where this translation is desired
    displayHTML Convert any HTML to entities so that the HTML will be visible as text instead of being rendered by the browser. Again this is typically only needed where the contents of a macro is supposed to be displayed, not executed
    removeHTML Completely remove any HTML. This flag may be useful in cases l like that described above for the childTagsOnly flag where undesired HTML is added by the Joomla! editors.
    loggedIn Valid only for the sdComment command. The loggedIn flag will cause the contents of the sdComment flag to be displayed only if a user is currently logged in.
    loggedOut Valid only for the sdComment command. The loggedOut flag will cause the contents of the sdComment flag to be displayed only if no user is currently logged in.