如何使自定义循环列表显示标题颜色、加粗等属性_动易Cms教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

问题:自定义循环列表如何显示标题颜色、加粗等属性?

解决:

默认自定义列表是不能显示标题字体颜色等属性的。可以通过修改源代码来实现。

在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"

保存文件之后就应该可以看到效果了。

查看更多 动易Cms教程  动易Cms模板

来源:模板无忧//所属分类:动易Cms教程/更新时间:2009-09-22
相关动易Cms教程