Template Variables

PieCMS uses the Smarty templating language and comes pre packed with the useful variables below. There is also a Snippets tab within the Layouts editor that will insert these variables.

Content

{$page} - The current url suffix

{$pageID} - The current page id

{$pageTitle} - The page title as defined in Web Page Manager

{$pageContent} - The page content

Sitewide

Sitewide content can be inserted into the template by using the sitewide variables listed in the sitewide page. These variables look like this:

{$siteWideContent_1706}

You are not on your own in trying to discover the id for the sitewide content. We have provided a list of sitewide areas in the Snippets dropdown on the Layouts page.

Navigation

All navigation data is stored in a {$navData} array. Each navData item has the following attributes:

{$navItem.pageID} - The unique page ID
{$navItem.label} - The name of the navigation item
{$navItem.href} - Link to the page
{$navItem.description} - A short description defined in pages
{$navItem.inNavigation} - Option to show or hide in navigation
{$navItem.inFooter} - Show item in the footer
{$navItem.newWindow} - Open in new window
{$navItem.subItems} - An array of sub items under this item

Below is a complete example of the navigation applied to a list:

<ul>
{foreach from=$navData item=navItem}
{if $navItem.inNavigation eq 1}
    <li{if $navItem.pageID eq $pageID} class="active"{/if}><a href="{$navItem.href}"{if $navItem.newWindow eq 1} target="_blank"{/if} title="{$navItem.description}">{$navItem.label}</a>
        {assign var='subItems' value=$navItem.subitems}
        {assign var="firstItem" value="1"}
    {if $subItems}
        <ul class="sub-menu">
        {foreach from=$subItems item=subItem}
            <li><a href="{$subItem.href}"{if $subItem.newWindow eq 1} target="_blank"{/if} title="{$subItem.description}">{$subItem.label}</a></li>
        {/foreach}
        </ul>                       
    {/if}                   
    </li>
{/if}
{/foreach}
</ul>

The above code is also available in the Snippets dropdown.