1. Download path on Smarty website: https://github.com/smarty-php/smarty/releases
2. Extract the downloaded Smarty
3. Copy the libs from the extracted smarty to the project you created.
4. Create two folders under Smarty: Templates store the template, and Templates_c store the compiled file
5. Write the following code in index.php:
<?php
Create a Smarty Object
Require_once './libs/smarty.class.php ';
Instantiating a Smarty Object
$smarty =new smarty ();
Setting variables and values
$smarty->assign ("var", "Hello World");
Apply Template file
$smarty->display ("hello.html");
?>
6. Create the corresponding hello.html file in the templates directory
The 7.hello.html file code is as follows:
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>insert title here</title>
<body>
{$var}//Introduce variable name
</body>
7. In the browser open index.php you will see Hello word!
PHP smarty Detailed configuration