Using Plugins

ExpressionEngine is designed so that features can be added through the use of Plugins.  The ExpressionEngine Plugins site contains a list of all available plugins, as well as installation and usage instructions for each one.

Basic Usage

Within your templates you'll typically wrap the item you want affected by the plugin:

{exp:xml_encode}
some content
{/exp:xml_encode}

In the above example, the content would be XML Encoded.

Nested Plugins

It is possible to nest Plugins in order for content to be affected by more than one plugin. For example, you can do this:

{exp:word_limit total="35"}
   {exp:xml_encode}
       some content
   {/exp:xml_encode}
{/exp:word_limit}

By default, ExpressionEngine will process the innermost Plugin first, then the next Plugin, and so on until all the plugins wrapping a given piece of content have been parsed. In the above example, the content is XML Encoded first and then the result of that is limited to 35 words.

Changing Parsing Order

You may change the parsing order and instruct ExpressionEngine to parse an outer Plugin first. This is done by adding a parse="inward" parameter to the Plugin opening tag. Using that parameter will tell EE to parse the that Plugin before parsing any Plugins inside of it.

parse="inward"

Examples

Here are some examples to help illustrate the parsing order.

{exp:magpie url="http://some-site.com" parse="inward"}
   {items}
      <a href="{link}">{title}</a><br />
      {exp:word_limit total="20"}{content}{/exp:word_limit}<br />
   {/items}
{/exp:magpie}

With the above, the "magpie" Plugin will be parsed first. This will allow the content of the {content} variable to be available to the other, nested Plugin: "word_limit".

Here is a much more complicated example that demonstrates both parsing orders in action.

{exp:magpie url="http://some-site.com" limit="15" refresh="720" parse="inward"}
<ul>
   {items}
      <li><a href="{link}">{title}</a><br />
         {exp:word_limit total="35"}
            {exp:xml_encode}
               {content}
            {/exp:xml_encode}
         {/exp:word_limit}
      </li>
   {/items}
</ul>
{/exp:magpie}

The outer "magpie" Plugin has the parameter set to parse inward, so it is parsed first. This makes the {content} variable's content available to the other Plugins. Next, is the "word_limit" Plugin. However, since by default EE parses Plugins outward, the "xml_encode" Plugin is parsed first and then "word_limit" after it. In this way, "word_limit" will never erase the closing tag for the "xml_encode" Plugin.

Top of Page