How can placeholders be effectively used in a .tpl file to display dynamic content fetched from a database in PHP?
To display dynamic content fetched from a database in a .tpl file using placeholders, you can first fetch the data from the database in your PHP file. Then, assign the fetched data to variables in your PHP code. Finally, pass these variables to your .tpl file and use placeholders to display the dynamic content.
// Fetch data from the database
$data = fetchDataFromDatabase();
// Assign fetched data to variables
$title = $data['title'];
$content = $data['content'];
// Pass variables to .tpl file
$smarty->assign('title', $title);
$smarty->assign('content', $content);
```
In your .tpl file, you can then use the placeholders like this:
```html
<h1>{$title}</h1>
<p>{$content}</p>