條件是: 某版塊的某分類資訊的資料
回複討論(解決方案)
某個板塊下的可以顯示的分類資訊(可用)
function get_threadclass($fid){$threadtypes = C::t('forum_forumfield')->fetch($fid);$threadtypes = dunserialize($threadtypes['threadtypes']);foreach(C::t('forum_threadclass')->fetch_all_by_fid($fid) as $type) {if(isset($threadtypes['types'][$type['typeid']])) {$return[]=$type;}}return $return;}
某個板塊下的可以顯示的分類資訊(可用)
function get_threadclass($fid){$threadtypes = C::t('forum_forumfield')->fetch($fid);$threadtypes = dunserialize($threadtypes['threadtypes']);foreach(C::t('forum_threadclass')->fetch_all_by_fid($fid) as $type) {if(isset($threadtypes['types'][$type['typeid']])) {$return[]=$type;}}return $return;}
好象我的表述有點問題: 是這樣
我主要是想要文章中的message欄位裡的資訊,條件是 該版塊下的 A子版塊中的 D主題分類的所有文章中的 message的內容
我想了一下,好象是要用到 pro_forum_post這個表及主題分類表 pre_forum_threadclass
因為 pro_forum_post裡面有message文章內容資訊的欄位,而 pre_forum_threadclass裡面是主題分類的表,但是這兩個表如何關聯呢?
我寫了一個句子,查不出來,不知哪裡錯了。
我是這樣寫的:SELECT sh_forum_post.message, sh_forum_post.fid FROM sh_forum_post, sh_forum_threadclass WHERE sh_forum_post.fid = 128 AND sh_forum_threadclass.`name` = '美麗圖片'
discuz中的表有一點很讓人鬧心,那就是很多表中的欄位沒有關聯性,都是獨立的,所以無法做出關聯準則來
某個板塊下的可以顯示的分類資訊(可用)
function get_threadclass($fid){$threadtypes = C::t('forum_forumfield')->fetch($fid);$threadtypes = dunserialize($threadtypes['threadtypes']);foreach(C::t('forum_threadclass')->fetch_all_by_fid($fid) as $type) {if(isset($threadtypes['types'][$type['typeid']])) {$return[]=$type;}}return $return;}
好象有點門,我是這樣想的,論壇裡預設的源碼中,點那些主題分類就可以出現我要的效果,看來源碼中就有這句sql
那,他是怎麼寫的呢,它的地址是這樣,幫我分析一下,謝謝你 jam00,
http://127.0.0.1/forum.php?mod=forumdisplay&fid=129&filter=typeid&typeid=26
pre_forum_thread裡的欄位typeid就是分類資訊的id