<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MoDoFo.println(" &#187; discuz</title>
	<atom:link href="http://zhangv.com/archives/tag/discuz/feed" rel="self" type="application/rss+xml" />
	<link>http://zhangv.com</link>
	<description>Life for Idea - forever young</description>
	<lastBuildDate>Sat, 07 Apr 2012 04:08:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Discuz如何让帖子列表的标题显示帖子附件中的图片</title>
		<link>http://zhangv.com/archives/1106</link>
		<comments>http://zhangv.com/archives/1106#comments</comments>
		<pubDate>Wed, 24 Jun 2009 02:26:46 +0000</pubDate>
		<dc:creator>zhangv</dc:creator>
				<category><![CDATA[技术(Tech)]]></category>
		<category><![CDATA[discuz]]></category>
		<category><![CDATA[代码]]></category>

		<guid isPermaLink="false">http://zhangv.com/archives/1106</guid>
		<description><![CDATA[Discuz的代码还是比较容易看懂的。关键是要找到需要改的地方。第1步：forumdisplay.php，用来准备要显示的帖子列表，然后用forumdisplay.htm作为显示模板。找到forumdisplay.php中的：$query = $sdb-&#62;query("SELECT t.* FROM {$tablepre}threads t&#160;&#160;&#160; &#160;&#160;&#160; WHERE t.fid='$fid' $filteradd AND $displayorderadd&#160;&#160;&#160; &#160;&#160;&#160; ORDER BY t.displayorder DESC, t.$orderby $ascdesc&#160;&#160;&#160; &#160;&#160;&#160; LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp");
替换为：$query = $sdb-&#62;query("SELECT t.*,min(att.attachment) as attm FROM {$tablepre}threads t&#160;&#160;&#160; &#160;&#160;&#160; LEFT JOIN {$tablepre}posts p ON p.tid=t.tid&#160;&#160;&#160; &#160;&#160;&#160; LEFT JOIN {$tablepre}attachments att ON att.tid=t.tid&#160;&#160;&#160; &#160;&#160;&#160; WHERE t.fid='$fid' [...]]]></description>
			<content:encoded><![CDATA[<p>Discuz的代码还是比较容易看懂的。关键是要找到需要改的地方。<br />第1步：<br />forumdisplay.php，用来准备要显示的帖子列表，然后用forumdisplay.htm作为显示模板。<br />找到forumdisplay.php中的：<br />$query = $sdb-&gt;query("SELECT t.* FROM {$tablepre}threads t<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; WHERE t.fid='$fid' $filteradd AND $displayorderadd<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ORDER BY t.displayorder DESC, t.$orderby $ascdesc<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp");</p>
<p>替换为：<br />$query = $sdb-&gt;query("SELECT t.*,min(att.attachment) as attm FROM {$tablepre}threads t<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LEFT JOIN {$tablepre}posts p ON p.tid=t.tid<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LEFT JOIN {$tablepre}attachments att ON att.tid=t.tid<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; WHERE t.fid='$fid' $filteradd AND $displayorderadd<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GROUP BY t.tid<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ORDER BY t.displayorder DESC, t.$orderby $ascdesc<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp");</p>
<p>意思很简单，把附件表中对应第一个附件选出来。这里有一点要注意，需要考虑附件类型，加一个图片类型的where条件即可。</p>
<p>第二步：<br />修改forumdisplay.htm<br />把第237行的：<br />&lt;span id="thread_$thread[tid]"&gt;&lt;a href="viewthread.php?tid=$thread[tid]&amp;amp;extra=$extra"$thread[highlight]&gt;$thread[subject]&lt;/a&gt;&lt;/span&gt;<br />替换为：<br />&lt;span id="thread_$thread[tid]"&gt;&lt;a href="viewthread.php?tid=$thread[tid]&amp;amp;extra=$extra"$thread[highlight]&gt;&lt;image width="100px" height="100px" src="attachments/$thread[attm]"/&gt;$thread[subject]&lt;/a&gt;&lt;/span&gt;<br />加个图片到链接里。</p>
<p>完成。</p>

	Tags: <a href="http://zhangv.com/archives/tag/discuz" title="discuz" rel="tag">discuz</a>, <a href="http://zhangv.com/archives/tag/%e4%bb%a3%e7%a0%81" title="代码" rel="tag">代码</a><br />
]]></content:encoded>
			<wfw:commentRss>http://zhangv.com/archives/1106/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

