Knowledgebase : Elevated X CMS > Version 3.2 > Smarty Template Reference


Smarty Support is Ending

For security, PHP 8 will be required by our software on January 31st, 2024. After this date, any website areas still using antiquated Smarty templates will need to be updated to use PHP templates.

If you wish to continue using Smarty templates after this date, the only way to do so is for us to stop pushing software updates to avoid breaking your websites.

This page contains information about moving over from the Smarty template system to PHP-based templates.

Setting up New Templates

Copies of our newest templates can be found here:

https://support.elevatedx.com/newest_templates.php

You can always see the various templates in action on our demo site by requesting a demo u/p here:
https://www.elevatedx.com/demo.php

Either your webmaster can set up new templates via the following guide:

https://support.elevatedx.com/index.php?/Knowledgebase/Article/View/285

Or you can contact support to set up a new area using PHP templates. You can contact our support here:

https://support.elevatedx.com/

Removing Areas No Longer In Use

If your system was using Smarty templates but no longer has active areas using Smarty, these areas must be removed from the system. This can be done by clicking the Gear Icon in the upper right-hand menu and selecting "Manage Site Areas" from the dropdown.

On this page, areas that are using Smarty are shown in red. If the "Last Viewed" section shows that this area has not been viewed in several months, you should be able to safely remove this from your system. Otherwise, only remove an area once you have migrated what is in use to use the updated PHP templates.

Stopping Software Updates

If you plan on continuing to use the Smarty template system after January 31st, 2024, please contact support. We will disable software updates for your site. After February 1st, 2024, in order to turn software updates back on, we will require that Smarty templates are no longer in use on any of your sites.

Templating Elevated X using the Smarty Templating Language

About Smarty:

Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic.
What this means for the Elevated X CMS is that the CMS provides data to the templates.  Smarty is what controls the formatting of this data.

Smarty Syntax:

You can find out more about Smarty syntax here:
http://www.smarty.net/

You can find out more about basic smarty syntax here:
http://www.smarty.net/docsv2/en/language.basic.syntax.tpl

Template Files:

By default, the template that the system uses is based on the name of the file that's being called.  For instance:
gallery.php uses /cms_admin/<smartyfolder>/gallery.tpl
index.php uses /cms_admin/<smartyfolder>/index.tpl
category.php uses /cms_admin/<smartyfolder>/category.tpl

Tours generally use the file tour1.tpl.

Data:

Almost universally, all data will come from a variable called $root.  $root includes all of the data that is passed to the smarty template system.  You can see a dump of this information by doing:

<pre>
{$root|@print_r}
</pre>

Of course, this is a daunting amount of information.  Sometimes, you will only be interested in an element that exists under root.  In this case, you can either do:

1) Print just that element:
<pre>
{$root.page.comingsoon|@print_r}
</pre>

2) Use the object browser (debug=root).  More information about this is listed below.

Includes:

Our CMS templates do not include the entire page's logic within one single template file.  Instead, we split the logic into separate files that can be then "included" into the template using the include tag.

Here's an example from index.tpl:

{foreach from=$root.page.comingsoon.item item=item}
<li class="coming_soon_item">{include file="$spath/index/comingsoon_item.tpl" item=$item}</li>
{/foreach}

Here's what this piece of code does:

    •    {foreach}: This tag cycles through what is known as an array.  In this case, the array is $root.page.comingsoon.item.

    •    item=item: For each set within $root.page.comingsoon.item, store the value temporarily within a variable called $item

    •    {include file="$spath/index/comingsoon_item.tpl" item=$item}.  This will call out to a separate template.  It will pass along the variable $item, so it can be used in that sub-template.


Elevated X commands that will help:

1) highlevelcachedebug=1

By adding this to a page URL, you will see vital caching information, such as which template folder is in use:

e.g: http://allaccess.elevatedx.com/members/?highlevelcachedebug=1
e.g: http://allaccess.elevatedx.com/members/gallery.php?id=171&type=vids&highlevelcachedebug=1

Here, you'll be able to see that the "smartyfolder" for this site is "smarty0".  This maps to the path:
/cms_admin/smarty/smarty0/

within the CMS.

2) debug=root

By adding this to your page URL as a PHP argument, you'll be able to see the whole contents of $root, along with some documentation on what each element does.

e.g: http://yoursite.com/members/?debug=root
e.g: http://yoursite.com/members/gallery.php?id=171&type=vids&debug=root

Note: We don't allow browsing the $root tag on our CMS demo since we have mod_security installed.  If you are getting an "Internal Server Error" when trying to browse $root, please contact your host.