# Basics
## Installation
For installation instructies, please see the [getting started section](../getting-started.md).
## Rendering a template
Here's how you create an instance of Smarty in your PHP scripts:
```php
display('string:The current smarty version is: {$smarty.version}.');
// or
echo $smarty->fetch('string:The current smarty version is: {$smarty.version}.');
```
## Using file-based templates
You probably want to manage your templates as files. Create a subdirectory called 'templates' and
then configure Smarty to use that:
```php
setTemplateDir(__DIR__ . '/templates');
```
Say you have a template file called 'version.tpl', stored in the 'templates' directory like this:
```smarty
Hi
The current smarty version is: {$smarty.version|escape}.
```
You can now render this, using:
```php
setTemplateDir(__DIR__ . '/templates');
$smarty->display('version.tpl');
```
## Assigning variables
Templates start to become really useful once you add variables to the mix.
Create a template called 'footer.tpl' in the 'templates' directory like this:
```smarty
Copyright {$companyName|escape}
```
Now assign a value to the 'companyName' variable and render your template like this:
```php
setTemplateDir(__DIR__ . '/templates');
$smarty->assign('companyName', 'AC & ME Corp.');
$smarty->display('footer.tpl');
```
Run this, and you will see:
```html
Copyright AC & ME Corp.
```
Note how the [escape modifier](../designers/language-modifiers/language-modifier-escape.md)
translated the `&` character into the proper HTML syntax `&`.