How can PHP efficiently loop through and render database content in a template using Smarty?

To efficiently loop through and render database content in a template using Smarty, you can fetch the data from the database using PHP, assign it to a Smarty variable, and then loop through the data in the Smarty template using a foreach loop.

// Fetch data from the database
$data = $db->query("SELECT * FROM table");

// Assign data to Smarty variable
$smarty->assign('data', $data);

// Display data in Smarty template
$smarty->display('template.tpl');
```

In your Smarty template (template.tpl), you can then loop through the data using a foreach loop like this:

```html
{foreach $data as $row}
    <p>{$row.name}</p>
{/foreach}