問題:自定義循環(huán)列表如何顯示標(biāo)題顏色、加粗等屬性?
解決:
默認(rèn)自定義列表是不能顯示標(biāo)題字體顏色等屬性的。可以通過修改源代碼來實(shí)現(xiàn)。
在include文件夾的Powereasy.Common.Front.asp這個(gè)文件里面有這樣一個(gè)函數(shù)
Function GetInfoList_GetStrTitle(Title, TitleLen, TitleFontType, TitleFontColor)
這個(gè)函數(shù)就是獲取到對(duì)應(yīng)文章的標(biāo)題顏色,字體等屬性,然后返回相應(yīng)的html代碼。
我們可以在自定義循環(huán)列表的代碼里面調(diào)用一下這個(gè)函數(shù)來實(shí)現(xiàn)我們的目的:
打開include文件夾的Powereasy.Article.asp,找到2352行左右的Private Function GetCustomFromLabel(strTemp, strList)函數(shù)
找到下面的代碼If TitleLen > 0 Then
strTemp = PE_Replace(strTemp, "{$Title}", GetSubStr(rsCustom("Title"), TitleLen, ShowSuspensionPoints))
Else
strTemp = PE_Replace(strTemp, "{$Title}", rsCustom("Title"))
End If
將這段代碼改成
If TitleLen > 0 Then
strTemp = PE_Replace(strTemp, "{$Title}", GetInfoList_GetStrTitle(rsCustom("Title"), TitleLen, rsCustom("TitleFontType"), rsCustom("TitleFontColor")))
Else
strTemp = PE_Replace(strTemp, "{$Title}", GetInfoList_GetStrTitle(rsCustom("Title"), 0, rsCustom("TitleFontType"), rsCustom("TitleFontColor")))
End If
因?yàn)檫@里我們需要用到字體顏色,字體類型兩個(gè)字段,所以我們還要修改一下SQL語句,加入這兩個(gè)字段。
還是找到這個(gè)函數(shù)的
sqlCustom = sqlCustom & "A.ArticleID,A.ChannelID,A.ClassID,A.Title,A.Subheading,A.Keyword,A.Intro,A.DefaultPicUrl"
替換成
sqlCustom = sqlCustom & "A.ArticleID,A.ChannelID,A.ClassID,A.Title,A.TitleFontType,A.TitleFontColor,A.Subheading,A.Keyword,A.Intro,A.DefaultPicUrl"
保存文件之后就應(yīng)該可以看到效果了。
新聞熱點(diǎn)
疑難解答
圖片精選