What are some best practices for integrating HTML design and layout with PHP and template systems like Smarty?

When integrating HTML design and layout with PHP and template systems like Smarty, it is important to keep the presentation separate from the logic. One best practice is to use template files for the HTML design and layout, and use PHP to handle the logic and data processing. This helps in maintaining a clean and organized codebase, making it easier to update and modify the design without affecting the functionality.

// Example of integrating HTML design with PHP using Smarty template system

// Include the Smarty library
require_once('libs/Smarty.class.php');

// Initialize Smarty
$smarty = new Smarty();

// Assign data to Smarty template variables
$smarty->assign('title', 'Welcome to my website');
$smarty->assign('content', 'This is the content of my page');

// Display the template
$smarty->display('index.tpl');