Reputation: 55
How can I output something from my database in a tpl file? Can I just add the php code to the .tpl. It's just a simple text from my database to be shown in my footer, whats the best way to do this? Here's my output code:
$sql = "SELECT `version` FROM `versionierung`";
$abfrageergebnis = mysql_query( $sql, $conID );
while ($datensatz = mysql_fetch_array( $abfrageergebnis ))
{
echo "<tr>";
echo "<td>" .htmlspecialchars( $datensatz['version'] ). "</td>";
echo "</tr>";
}
Upvotes: 0
Views: 51
Reputation: 159
if you are using smarty here, you can use 'assign' functions/tags accordingly. Smarty doc provides more details with samples, http://www.smarty.net/docs/en/language.function.assign.tpl
Eg.
<?php
$smarty->assign('foo','Your value');
Upvotes: 1