Editing version 3 of page APIs_RegShortCode (this is the most recent revision)
Note: This page is defined as a special page, and as such its final state may be different from what you see here.
Use template:
None
API_Template
DevTrack_Template
Version_Template
//**NOTE:** This API was introduced in [[Version 0.40]]//
==Subroutine Name
**RegShortCode**
==Explanation and Usage
This subroutine registers a [[Short Codes|short code]] and its associated subroutine. You will then call a short code in your page by placing the text `%ShortCodeName%` where you want its output to go. It's important to note that short codes do not print directly, rather, they return text (which must be HTML formatted, not Markup formatted as this will get called after **Markup()** is run).
It should be noted that anything after the short code is passed as an argument to the subroutine defined. For example, if 'ShortCodeName' was defined to call the subroutine DoShortCodeName(), then `%ShortCodeName This is a test%` would equate to calling DoShortCodeName("This is a test").
==Syntax
**`RegShortCode(Name, Subroutine)`**
==Options
**Name** - This is the name to associate with the action.
**Subroutine** - This should be the subroutine that is called when the action you specify is called via the 'do' parameter. Must be entered in this format: \&SubroutineName
==Examples
These are actual examples from the Aneuch source code:
**`RegShortCode('search', \&DoSearchShortCode);`**\\In this example, which comes from the InitVars sub, we're registering the 'search' short code, which will call the sub **DoSearchShortCode()**.
This page is a template
Summary:
User name:
Upload a file
By contributing to this wiki, you acknowledge that you waive your right to claim copyright of your individual contributions. The text of this site is uncopyrighted and released to the public domain.
Show markup help Styling **bold **, //italic //, __underline __, --strikethrough--, `teletype ` Headers = Level 1 =, == Level 2 ==, === Level 3 ===, ==== Level 4 ====, ===== Level 5 ===== (ending ='s optional) Lists * Unordered List, # Ordered List, ** Level 2 unordered, ### Level 3 ordered (up to 5 levels, NO SPACES IN FRONT) Links [[Page]], [[Page|description]], [[http://link]], [[http://link|description]] Images {{image.jpg}}, {{right:image.jpg}} (right aligned), [[link|{{image.jpg}}]] (image linked to link), {{image.jpg|alt text}} Extras ---- (horizonal rule), ~~~~ (signature)