{$MY_首頁推薦圖片文章}怎么寫?
問題:如何制作涉及數(shù)據(jù)庫多表操作的標(biāo)簽,比如想在首頁顯示一最新推薦圖片文章。
解決方法:按函數(shù)標(biāo)簽說明(/help/PowerEasy2006/1148.html),制件標(biāo)簽如下:
查詢語句:
select top 1 * from PE_Article where Elite={$PE_True} order by ArticleID DESC
標(biāo)簽內(nèi)容:
{Loop}{Infobegin}
<table height=50 cellSpacing=0 cellPadding=0 width=530 align=center border=0>
<tr>
<td><A href="{$InstallDir}{$Field(0,GetUrl,Article,1)}" target=_blank><IMG height=50 src="{$InstallDir}Article/UploadFiles/{$Field(21,Text,0,0,0)}" width=530 border=0></A></td>
</tr>
</table>
{Infoend}{/Loop}
通常網(wǎng)站中有幾個文章類型的頻道,而最新的文章又不確定在某個文章類型的頻道下。那么把上述標(biāo)簽添加到首頁,就可能存在圖片不顯示的問題。
比如首頁顯示的圖片應(yīng)該是http://www.***.net/zixun/UploadFiles_7381/200809/2008092616374776.gif
結(jié)果按上述標(biāo)簽形成的圖片路徑:http://www.***.net/Article/UploadFiles/200809/2008092616374776.gif
顯然標(biāo)簽中“{$InstallDir}Article/UploadFiles/”是把圖片都放在默認的文章頻道中,寫法是不正確的。
那么,我們?nèi)绾伟?ldquo;Article”替換為圖片實際所在的頻道目錄、“uploadfiles”替換成圖片實際所在的頻道的上傳文件目錄,顯示標(biāo)簽的查詢語句不對,沒有調(diào)出具體的頻道目錄和頻道上傳目錄。修改代碼如下:
查詢語句:
select top 1 PE_Article.ArticleID,PE_Article.ChannelID,PE_Article.Title,PE_Article.DefaultPicUrl,PE_Channel.ChannelDir,PE_Channel.UploadDir from PE_Article inner join PE_Channel on PE_Article.ChannelID = PE_Channel.ChannelID where PE_Article.Elite={$PE_True} order by ArticleID DESC
標(biāo)簽顯示代碼:
{Loop}{Infobegin}
<table height=50 cellSpacing=0 cellPadding=0 width=530 align=center border=0>
<tr>
<td><A href="{$InstallDir}{$Field(0,GetUrl,Article,1)}" target=_blank><IMG height=50 src="{$InstallDir}{$Field(4,Text,0,0,0)}/{$Field(5,Text,0,0,0)}/{$Field(3,Text,0,0,0)}" width=530 border=0></A></td>
</tr>
</table>
{Infoend}{/Loop}
可以通過修改顯示代碼,顯示圖片文章標(biāo)題、顯示多個圖片等等。
新聞熱點
疑難解答
圖片精選