如果問題不清楚,請道歉。新手關於在頁面上添加數組元素的問題(php腳本)
我是一個總的新手php用戶,我有這個腳本,我想編輯。
腳本使用.tpl作爲主題。
在memberprofile.tpl
存在first name
元素$profilearray[0].firstname
我也想加入這個結果元素的另一個.tpl
文件名爲docs.tpl
我試圖複製和粘貼在docs.tpl
`$profilearray[0].firstname
,但沒有奏效。 我注意到docs.tpl
使用它自己的$docsarray[0].xxx
所以大家任何想法如何做到這一點?因爲我希望將會員資料中的一些信息添加到文檔頁面中。
我試圖與MySQL玩,但我不知道如何使用同一元素firstname
兩個memberprofile
和docs
表
我敢肯定有一個簡單的方法來做到這一點。
下面是從memberprofile.tpl
完整的代碼,我想展示一些這些信息在該主題docs.tpl
<p class="gray">
{$lang112}: <b>{$profilearray[0].firstname} {$profilearray[0].lastname}</b><br>
{$lang130}: <b>{$profilearray[0].birthday}</b><br>
{$lang134}: <b>{if $profilearray[0].gender eq "1"}Male{elseif $profilearray[0].gender eq "0"}Female{/if}</b><br>
{$lang140}: <b>{$profilearray[0].city}</b> <br>
{$lang139}: <b>{$profilearray[0].country}</b> <br>
{$lang113}: <b>{insert name=get_stripped_phrase value=a assign=pdesc details=$profilearray[0].description}{$pdesc}</b> <br>
{$lang259}: <b><a href="{$profilearray[0].url}" target="_blank">{$profilearray[0].url|stripslashes|truncate:20:"...":true}</a></b> <br>
{$lang260}: <b>{insert name=get_time_to_days_ago value=var time=$profilearray[0].lastlogin}</b> <br>
{$lang261}: <b>{insert name=get_time_to_days_ago value=var time=$profilearray[0].addtime}</b>
</p>
這些'.tpl'文件屬於哪個模板引擎? – hakre 2011-06-10 18:51:33
看起來像Smarty對我。 – 2011-06-10 18:52:10
看起來像samrty – mcgrailm 2011-06-10 18:53:07