0
目前,我有我的數據庫中以下Smarty的兩個變量,我得到一個錯誤,當嘗試在相同的字符串運行2
tn_pic1
tn_pic2
他們舉行了一個文件名各一個,對於例如tn_X_wm.jpg
X =數量和JPG可能是GIF,PNG,BMP
因此,例如在tn_pic1我可以tn_1_wm.jpg但tn_pic2我可以tn_2_wm.png
在我.tpl文件我目前有:
{if $item.pic_count > 0}
{rand(1,$item.pic_count) assign="yourVar"}
<img src="users/images/{$item.id}/{$item.tn_pic1}" width="100" height="100" class="smallpic" alt="" />
{/if}
我想用蘭特數量$ item.tn_pic1
我已經試過 {$項目.tn_pic {$ yourVar}}但因爲我有2得到一個錯誤{}
那麼我想是{$ item.tn_picX}
X是蘭特數。
我是smarty新手,並不確定如何排序。
$ item。通過PHP文件,從數據庫提取
謝謝非常 :) – Garry