ExpressionEngine Docs

Preload Text Replacements

ExpressionEngine allows you to assign text to be replaced prior to a template being parsed, to save time typing and editing certain bits of text that might get used multiple times. Preload Replacements act as a straight string replacement for use later in the same template.

Assignment and replacement occurs instantly when the template is loaded, before any tags are parsed, and therefore may not be affected by the result of another tag’s output.

Creating and Using an Preload Replacements

The basic syntax for replacing text is this:


In the above example, variable_name is the name of the template “variable” and replacement is the content that will be used to replace all occurrences of {variable_name} in the template.

Example Usage

A common usage for preload replacements is to hold the Channel short name(s), to save you from repeatedly typing them into different tags within the same template. :


{exp:channel:category_heading channel="{channels}"}
    {if category_description != ""}<p>{category_description}</p>{/if}

{exp:channel:entries channel="{channels}" limit="10"}