SMARTY template system

Windu CMS is using the SMARTY template system. Generally it is an engine that allows a more advanced and at the same time simpler way of using PHP from the HTML code level.

For example if we wanted to execute PHP code in our index.php file without SMARTY we'd have have to call out the code starting with php markers, with smarty it's simpler.

{$my_variable}

As you can see it's much simpler.

As you can probably see in Windu we're sometimes using single curly braces and sometimes double. Single braces are used in code of the CMS system and in widgets, however in templates we are using double braces system. What marker we're using can be declared in Smarty config. We've decided to use double braces so that user could use curly braces with no problems, since they are not a special marker calling out Smarty.

Syntax

Of course the variable has to be transfered to the Smarty engine. There are two ways to do it. We can call out the correct code from controller level in, meaning the same place where we define launch of the smarty engine (we will look into this in the part concerning widgets). The second option is defining a variable from template level.

Hello {$firstname} {$lastname}, glad to see you can make it.
{* this will not work as $variables are case sensitive *}
This weeks meeting is in {$meetingplace}.
{* this will work *}
This weeks meeting is in {$meetingPlace}.

Modificators

Each variable can be easily modified, cut or can have other operations performed on it. In order to do so we have a whole range of very useful and simple tools.
Smarty documentation shows what they can be used for very well.http://www.smarty.net/docs/en/language.modifiers.tpl
List of available modificators