Topics

chain function (DEPRECATED)

Chaining was a way to combine the functionality of one module (or controller) with another. However, it has been replaced by the showmodule function.  When using the {chain} 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">
      {chain 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 chained 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">
      {chain 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.

You can chain either a 'module' or a 'controller'

  • For a module, the following parameters can be used:
    • module = 'module_name'
    • title = 'module title'
    • view = view_name' (default is 'Default')
    • action = 'module_action'
    • params = 'array of named parameters to pass', e.g., params="array('id'=>`$form->id`)"
    • chrome = 'anything' to display the module menu (default is leave menu off)
  • •For a controller, the following parameters can be used:
    • controller = 'controller_name'
    • view = 'view_name' (default is 'index')
    • action = "controller_action'
    • scope = 'controller_scope' (default is 'global')
    • source = 'controller_source'
    • chrome = 'anything' to display the module menu (default is leave menu off)
Loading Help