效果如图
假如文章不存在图片。则显示默认的图片
如图
修改方法
1.找到include文件夹PowerEasy.Article.asp文件1467行开始的代码
将下列函数改成以下代码。
'=================================================
'函数名:GetPrevArticle
'作 用:显示上一篇文章
'参 数:TitleLen ----标题最多字符数,一个汉字=两个英文字符
'=================================================
Private Function GetPrevArticle(TitleLen)
Dim rsPrev, sqlPrev, strPrev,picurl
strPrev = Replace(XmlText_Class("ShowArticle/PrevArticle_Link", "<li>上一{$ItemUnit}: "), "{$ItemUnit}", ChannelItemUnit & ChannelShortName)
sqlPrev = "Select Top 1 ArticleID,DefaultPicUrl,Title,Author,UpdateTime,Hits,InfoPurview,InfoPoint from PE_Article Where ChannelID=" & ChannelID & " and Deleted=" & PE_False & " and Status=3 and ReceiveType=0 and ClassID=" & rsArticle("ClassID") & " and ArticleID<" & rsArticle("ArticleID") & " order by ArticleID DESC"
Set rsPrev = Conn.Execute(sqlPrev)
If TitleLen < 0 Or TitleLen > 255 Then TitleLen = 50
If rsPrev.EOF Then
strPrev = strPrev & XmlText_Class("ShowArticle/NoPrevArticle", "没有了")
Else
If Instr(rsPrev("DefaultPicUrl"),".") then
picurl="/"&ChannelDir&"/"&UploadDir&"/"&rsPrev("DefaultPicUrl")
else
picurl=SiteUrl&"images/nopic.gif"
end if
strPrev = strPrev & "<br><a class='LinkPrevArticle' href='" & GetArticleUrl(ParentDir, ClassDir, rsPrev("UpdateTime"), rsPrev("ArticleID"), ClassPurview, rsPrev("InfoPurview"), rsPrev("InfoPoint")) & "'"
strPrev = strPrev & " title='" & Replace(Replace(Replace(Replace(strList_Title, "{$Title}", rsPrev("Title")), "{$Author}", rsPrev("Author")), "{$UpdateTime}", rsPrev("UpdateTime")), "{$br}", vbCrLf) & "'><img src='"&picurl&" 'border=0></a><br><a class='LinkPrevArticle' href='" & GetArticleUrl(ParentDir, ClassDir, rsPrev("UpdateTime"), rsPrev("ArticleID"), ClassPurview, rsPrev("InfoPurview"), rsPrev("InfoPoint")) & "'"
strPrev = strPrev & " title='" & Replace(Replace(Replace(Replace(strList_Title, "{$Title}", rsPrev("Title")), "{$Author}", rsPrev("Author")), "{$UpdateTime}", rsPrev("UpdateTime")), "{$br}", vbCrLf) & "'>" & GetSubStr(rsPrev("Title"), TitleLen, ShowSuspensionPoints) & "</a>"
End If
rsPrev.Close
Set rsPrev = Nothing
strPrev = strPrev & "</li>"
GetPrevArticle = strPrev
End Function
'=================================================
'函数名:GetNextArticle
新闻热点
疑难解答
图片精选