[改良修正] 即時分析顯示主題內的Tag標籤

標題雖然那樣打
但是其實是以往發文之後就算有輸入tag標籤
在主題內也不一定會被分析
原因是DZ設計上 其實是只有分析熱門標籤而已(而且是緩存)
所以才會讓人覺得好像發完主題Tag標籤沒有用的感覺
這個修改之後 查看主題時就會分析該主題內所設定的標籤


開啟 viewthread.php

$query = $db->query("SELECT tagname FROM {$tablepre}threadtags WHERE tid='$tid'");
		$thread['tags'] = '';
		while($tags = $db->fetch_array($query)) {[/php]
改為
[php]$thread['tagslist'] = array();
		
		$query = $db->query("SELECT tagname FROM {$tablepre}threadtags WHERE tid='$tid'");
		$thread['tags'] = '';
		while($tags = $db->fetch_array($query)) {
			$thread['tagslist'][] = $tags['tagname'];[/php]
找
[php]function viewthread_parsetags() {
	global $tagstatus, $_DCACHE, $firstpid, $postlist;
	global $thread;
	
	if($firstpid && $tagstatus && !sprintf('%01b', $postlist[$firstpid]['htmlon']) && !empty($_DCACHE['tags'])) {
		..這中間略過..
	}[/php]
底下加上
[php]	if($firstpid && $tagstatus && !sprintf('%01b', $postlist[$firstpid]['htmlon']) && $thread['tagslist']) {
		foreach($thread['tagslist'] as $tags) {
			$postlist[$firstpid]['message'] = preg_replace("/(^|>)([^><'\"]*?)(".preg_quote($tags, '/').")([^><'\"]*?)(<|$)/eiU", "'\\1\\2<span href=\"tag.php?name='.rawurlencode('\\3').'\" onclick=\"tagshow(event)\" class=\"t_tag\">\\3</span>\\4\\5'", $postlist[$firstpid]['message'], 1);
		}
	}
完成
複製這篇網址分享給朋友: http://discuz.bluelovers.net/thread-4235-1.html#pid6466

本篇的內容不含引用除另有聲明外,如符合 CC授權條款 則套用 姓名標示-非商業性-相同方式分享 3.0 通用版

套一句黃小琥說過的話:「你可以點歌,但是我可以選歌」

RE: [改良修正] 即時分析顯示主題內的Tag標籤

Admin,我按照你的方式修改完畢,但是發新貼時,縱使有輸入tag,新貼的內容依舊看不到即時顯示的tag
請見....
http://www.ntd2u.net/thread-1862-1-1.html

可否幫我看一下問題何在?

另外請教...標籤功能會區分英文字的大小寫,例如Abc這個標籤並不等於abc這個標籤,修改為不區分英文字的大小寫是不是比較有意義呢?若要改的話該怎麼改?

先感謝Admin或其他撥冗回答的人!
複製這篇網址分享給朋友: http://discuz.bluelovers.net/thread-4235-1.html#pid60417

本篇的內容不含引用除另有聲明外,如符合 CC授權條款 則套用 姓名標示-非商業性-相同方式分享 3.0 通用版

TOP