问题
I am just starting to use Smarty templates and have this very simple query:
$result = mysql_query("SELECT `name`, `min_price` FROM `tblproductgroups` WHERE `hidden` != 'on' ORDER BY `order` ASC");
$data = mysql_fetch_array($result);
$ca->assign('products', $data);
And tempate file is like this:
{foreach from=$products key=key item=product}
{$product.name} - {$product.id}<br/>
{/foreach}
And the outcome comes out like this:
V - V
V - V
6 - 6
6 - 6
V is the first character for VPS (name) and 6 is the first character of price. How can I make Smarty to display the full information?
来源:https://stackoverflow.com/questions/19276200/smarty-displaying-only-first-character-from-foreach