解决热点新闻,最新新闻,推荐新闻大类标签不起作用的问题_风讯Cms教程
比如:我的网站有:
技术文章(Article.xqinfo.net),
下面有三个二级栏目:饲料营养(Doc_Nutrition),饲料营养(Doc_Feeding)和疫病防治(Doc_Disease)
二级栏目下还有子栏目,就不再多说了,我在http://Article.xqinfo.net的首页想调用热点新闻,
我做了一个标签调用技术文章的热点文章如:{%=HotNews("Article","10","26","1","","/Files/LabelPictures/back_3.gif","1","NewsTitle","20","·")%}
但是,这个标签根本不起作用!!!
其实调用任何一个有下级栏目的栏目的热点新闻,最新新闻,推荐新闻等,原3.0系统都不能够实现!
两种情况下3.0的热点,推荐,最新新闻等能够实现:
1. {%=HotNews("","10","26","1","","/Files/LabelPictures/back_3.gif","1","NewsTitle","20","·")%}
栏目名为空,即网站总栏目,但统统调用,不分栏目,就像我的站点,新闻动向,技术文章,图片影视,企业治理等统统调用
2. {%=HotNews("英文栏目名称","10","26","1","","/Files/LabelPictures/back_3.gif","1","NewsTitle","20","·")%}
这个栏目必须是最底级的栏目,如我的站点:营养理论(是最底级栏目,上级为饲料营养,再上级为技术文章)
为什么会出现这个情况?----因为我们一般不可能在存在子栏目的父级栏目里发表新闻!!!
所以我们就提出了修改方案,主要就是修改/Admin/Refresh/RefreshFunction.asp文件
第一步:将该文件的代码(热点新闻调用代码)807行
HotNewsSql = "Select *,NewsClass.FileExtName as ClassFileExtName,News.FileExtName as NewsFileExtName from News,NewsClass where News.ClassID=NewsClass.ClassID and DelTF=0 and News.AuditTF=1 and NewsClass.ClassEName='" & ClassEName & "' order by News.ClickNum Desc"
替换为:
Dim ClassSql,RsClassObj,AllClassID
ClassSql = "Select ClassID from NewsClass where ClassEName='" & ClassEName & "'"
Set RsClassObj = Conn.Execute(ClassSql)
if Not RsClassObj.Eof then
AllClassID = "'" & RsClassObj("ClassID") & "'" & ChildClassIDList(RsClassObj("ClassID"))
HotNewsSql = "Select *,NewsClass.FileExtName as ClassFileExtName,News.FileExtName as NewsFileExtName from News,NewsClass where News.ClassID=NewsClass.ClassID and News.ClassID in (" & AllClassID & ") and DelTF=0 and News.AuditTF=1 order by News.ClickNum Desc"
else
HotNews = "请确认栏目是否存在! "
Exit Function
end if
Set RsClassObj = Nothing
第二步:将该文件中的代码(最新新闻调用代码)837行
- 相关链接:
- 教程说明:
风讯Cms教程-解决热点新闻,最新新闻,推荐新闻大类标签不起作用的问题。