showmodule function
Showmodule is a way to combine the functionality of one module (or controller) with another. It replaces the {chain} function. When using the {showmodule} plugin within your views, you're actually hard-coding your module in to the view of another module . Here's an example:
<div class="bodycopy"> {showmodule controller="snippet" action="showall" source="txtsnip"} {$text->body} </div>
In the above example, we're hard-coding a snippet module within a text module view. However, if we have more than one item, the displayed content will be duplicated per item since they will all have the same source. Let's all for a unique source, so that each text item can have it's own code snippet.
<div class="bodycopy"> {showmodule controller="snippet" action="showall" source="txtsnip`$text->id`"} {$text->body} </div>
In the above code, we've concatenated the word txtsnip with the text items ID, guaranteeing that our source will be unique.
Showmodule works for either a 'module' or a 'controller'. It simply calls the expTheme::module() method so it accepts the same parameters. It is fairly smart in case you mix up parameters between a module or controller.
The following parameters can be used:
- module or controller = controller or module name sans the 'module' or 'Controller' suffix, this param is interchangable
- action = the action
- view = the view name' (default for modules is 'Default', for controllers is 'showall', controller views must NOT include action prefix, e.g., showall_random, MUST be passed as 'random' with the aciton of 'showall')
- source = controller 'source'
- scope = controller scope (default is 'global')
- moduletitle = the module title
- params = 'array of named parameters to pass', e.g., params="array('id'=>`$form->id`)"
- chrome = '1' to display the module menu (default is leave menu off)