Environment: PHP5.2 or later
Go to the official website to download the Smarty Template engine library file to your computer or server
Smarty Official Website library files: https://www.smarty.net/download
Unzip to local after download is complete
Useful is the file inside the Libs folder, create a new smarty directory under your www directory, copy the Libs directory into the Smarty directory,
In particular, you need to note that your Templates_c folder must have writable permissions, if not, you can set the local to 777,
chmod 777 Templates_c
Then you also need to create four folders in the Smarty directory templates, Templates_c, cache, configs
Then enter the following code in your Smarty directory under index.php (create a new one yourself):
<? PHP require (' Smarty.class.php '); $smarty New Smarty; $smarty->assign (' name ', ' Ryan '); $smarty->display (' Index.tpl ');
Then create the Index.tpl file in the templates directory, the suffix name of this file is not fixed, you can be named according to your project.
Enter the following code in the TEMPLATES/INDEX.TPL:
Hello, {$name}! </body>
Open the browser, enter localhost/smarty/index.php see the following results indicate that the installation was successful.
PHP smarty Template engine Basic installation