Designer Manuals


Tags are a way to put dynamic content into your theme layouts and partials. They represent functions or variables that are made available via plugins. Tags can also accept attributes that affect their output. Tags are surrounded by curly braces and start with "pyro" (the trigger word can be changed in system/pyrocms/config/tags.php), followed by the module, or plugin name you are accessing, and the specific variable or function. Each of these is separated by a colon. For example:

{pyro:settings:site_name}

The above will be replaced by the site name from your site settings. This usage is most basic of PyroCMS tags.

Tag Parameters

Tags can be modified via parameters that are included after the tag definition. They follow a simple parameter="value" syntax. For example:

{pyro:template:partial name="sidebar"}

The above will be replaced by a partial in your template. For the tag to know which template to replace, you need to pass the "name" parameter. Some parameters are required and some are optional.

Tag Pairs

Instead of being replaced by a single value, tags can be paired to loop through multiple values. For example:

{pyro:pages:children id="2" limit="5"}
	<h1>{title}</h1>
	<p>{body}</p>
{/pyro:pages:children}

The above will loop through child of the page defined by the id parameter, replacing and with the title and body values for each entry.

Tag Conditionals

PyroCMS tags have the ability to perform simple conditionals, allowing you to display data based on variables in your templates.

Tag conditionals use the following format:

{if '{pyro:lang:name }}' == 'ltr'}
	{pyro:theme:js file="cufon.js"}
{/if}

The above code checks the value of English to see if it equals 'ltr', and displays a js file if this is true.

PyroCMS' conditionals also support ifelse and else conditionals:

{if '{pyro:url:segments segment="2"}' == 'blog'}
	{pyro:widgets:area slug="blog"}

{elseif '{pyro:url:segments segment="2"}' == 'home'}
	{pyro:widgets:area slug="home"}

{else}
	No widgets available.
{/if}