` Tag Introduction – ExpressionEngine Documentation

Tag Introduction

This page is designed to be a general introduction to the concept of "Tags", "Variables", and "Parameters" as they are used within ExpressionEngine. You'll also want to make sure you read the Template Introduction.


A typical ExpressionEngine tag looks like this:


The first part of the tag, exp:, tells ExpressionEngine that this is a tag. The second part, weblog, is the module that the tag belongs to, in this case the "weblog" module. The third part (which not every tag will have) is the specific function from within the module that you're calling; in this case the function to display the "weblog_name".

There are two kinds of tags: single tags and tag pairs. A single tag does not have a closing tag:


Single tags are designed to return a single value or a single piece of unformatted data.

Tag pairs look like this:


Entry content


Tag pairs can contain information between the opening and closing pair: HTML, variables, etc.


Tag pairs usually contain variables between the tags. Variables look like this:


This variable, for instance, might show the title of a weblog entry. Variables are used like this within tags:




<div class="author">Posted by {author}</div>



Most tags can have parameters. Parameters modify the behavior of a tag. Parameters are placed inside the opening tag:

{exp:weblog:entries parameter="value"}

A typical tag with parameters might look like this:

{exp:weblog:entries weblog="news" username='rick' order="desc" limit='10' offset="1"}

The above tag will show 10 weblog entries (but not the very latest entry: offset="1") written by the author with the username "rick" in the "news" weblog. They will be displayed in descending order.

Note: You can use either single quotes (username='rick') or double quotes (order="desc") when specifying parameters.

Parameters give you the flexibility to tailor the output of tags in a multitude of ways. Instead of setting master preferences in the Control Panel, you'll set preferences in each tag through the use of parameters.

A single tag can have almost infinite flexibility. No longer will you have to choose from several ready-made tags that do slight variations of a similar function. You can use the same tag in a variety of different ways simply by altering the parameters.