問題:自定義循環列表如何顯示標題顏色、加粗等屬性?
解決:
默認自定義列表是不能顯示標題字體顏色等屬性的。可以通過修改源代碼來實現。
在include文件夾的Powereasy.Common.Front.asp這個文件里面有這樣一個函數
Function GetInfoList_GetStrTitle(Title, TitleLen, TitleFontType, TitleFontColor)
這個函數就是獲取到對應文章的標題顏色,字體等屬性,然后返回相應的html代碼。
我們可以在自定義循環列表的代碼里面調用一下這個函數來實現我們的目的:
打開include文件夾的Powereasy.Article.asp,找到2352行左右的Private Function GetCustomFromLabel(strTemp, strList)函數
找到下面的代碼
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
因為這里我們需要用到字體顏色,字體類型兩個字段,所以我們還要修改一下SQL語句,加入這兩個字段。
還是找到這個函數的
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"
保存文件之后就應該可以看到效果了。
新聞熱點
疑難解答
圖片精選