Controls are small reusable chunks of code that perform a specific action – usually, to render a piece of HTML. Wild Apricot uses controls mainly for wrapping gadgets in styled containers. Thus we achieve a form of separation – controls define gadget appearance, and gadgets themselves define their functionality.
You can call controls from gadgets and master layout templates.
Control types
In Wild Apricot, we use the following types of controls:
- Captcha – HTML to render Captchas
- Divs – wrapper DIVS used in old themes
- Form – form wrapper
- FormHelpers – helper for rendering standard form elements
- MessageBox – wrapper for message boxes used in our system
- StyledWrappers – wrappers for gadget styles (see Customizing gadget styles in themes for more details)
Calling controls
The basic syntax for calling controls is:
<$control.ControlName(param = "val")$>
Please note that you pass parameters to controls in the same way as you pass parameters to gadgets. For more information, see Passing parameters.
Creating controls
To create a control, follow these steps:
- Create a folder under the Controls folders.
- Create a ControlTemplate.tpl file in the new subfolder (from scratch or by copying an existing file from another Controls subfolder).
- Modify the ControlTemplate.tpl file.