Discuz!x2.0 帖子图片附件 alt 自动显示为帖子主题的方法

修改方法如下:

修改 Discuz X 模板目录 template/default/forum/discuzcode.htm 文件
找到大约 190 行左右 alt=”$attach[imgalt]” title=”$attach[imgalt]”

修改为 alt=”{$_G[forum_thread][short_subject]}-$attach[imgalt]” title=”{$_G[forum_thread][short_subject]}-$attach[imgalt]”

修改后的代码如下
<!–{if $_G[‘setting’][‘thumbstatus’] && $attach[‘thumb’]}–>
<img{if $attach[‘price’] &&
$_G[‘forum_attachmentdown’] && $_G[‘uid’] != $attach[‘uid’]}
{/if} style=”cursor:pointer” id=”aimg_$attach[aid]”
src=”{STATICURL}image/common/none.gif” zoomfile=”{if
$attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}”
file=”{if
$attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode{else}{$attach[url]}$attachthumb{/if}”
inpost=”1″ alt=”{$_G[forum_thread][short_subject]}-$attach[imgalt]”
title=”{$_G[forum_thread][short_subject]}-$attach[imgalt]” />
<!–{else}–>
<img{if $attach[‘price’] &&
$_G[‘forum_attachmentdown’] && $_G[‘uid’] != $attach[‘uid’]}
{/if} id=”aimg_$attach[aid]”
src=”{STATICURL}image/common/none.gif” zoomfile=”{if
$attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes¬humb=yes{else}{$attach[url]}$attach[attachment]{/if}”
file=”{if
$attach[refcheck]}forum.php?mod=attachment{$is_archive}&aid=$aidencode&noupdate=yes{else}{$attach[url]}$attach[attachment]{/if}”
$widthcode id=”aimg_$attach[aid]” inpost=”1″
alt=”{$_G[forum_thread][short_subject]}-$attach[imgalt]”
title=”{$_G[forum_thread][short_subject]}-$attach[imgalt]” />
<!–{/if}–>
我去掉了图片附件这个下载提示代码,
onmouseover=”showMenu({‘ctrlid’:this.id,’pos’:’12’})”
可能不太一样,效果是一样的