What are some best practices for nesting templates in PHP with Smarty?

When nesting templates in PHP with Smarty, it is important to follow best practices to ensure clean and maintainable code. One common approach is to use inheritance to create a base template that contains the overall structure of the page, and then extend this base template in child templates to add specific content. This allows for reusability and separation of concerns.

// Base template (base.tpl)
<!DOCTYPE html>
<html>
<head>
    <title>{block name=title}Default Title{/block}</title>
</head>
<body>
    {block name=content}{/block}
</body>
</html>

// Child template (child.tpl)
{extends file="base.tpl"}
{block name=title}Child Title{/block}
{block name=content}
    <p>This is the content of the child template.</p>
{/block}