What is the purpose of using Smarty in PHP templates?

Using Smarty in PHP templates helps separate the presentation layer from the business logic in web applications. It provides a way to create reusable templates with clean and readable syntax, making it easier for designers and developers to collaborate on the frontend. Smarty also offers features like template inheritance, caching, and escaping to improve performance and security.

// Example of using Smarty in PHP templates

require_once('smarty/Smarty.class.php');

$smarty = new Smarty;

$smarty->assign('name', 'John Doe');
$smarty->display('index.tpl');