What are the benefits of using template systems like Smarty in PHP development, and how can they help separate design from code?

Using template systems like Smarty in PHP development helps separate design from code by allowing developers to create templates that contain HTML markup and placeholders for dynamic content. This separation makes it easier to maintain and update the design of a website without having to modify the underlying PHP code. Additionally, template systems like Smarty provide features such as template inheritance, caching, and escaping to improve code organization and security.

// Example of using Smarty template engine in PHP
require_once('smarty/Smarty.class.php');

$smarty = new Smarty;

$smarty->assign('title', 'Welcome to Smarty!');
$smarty->assign('content', 'This is a sample content for demonstration purposes.');

$smarty->display('template.tpl');