Seite 1 von 1

Word/Tag Cloud Mod - Wörter ausschließen

Verfasst: 05.06.2008 10:06
von tts
Hi,

Ich habe mir diese MOD

http://www.phpbbhacks.com/download/7836

in meinem Forum installiert, nur werden jetzt auch wörter angezeigt, die als suchbegriff eher sinnlos sind, wie kann ich denn wörter ausschließen.

Code: Alles auswählen

################################################################################
##
##	Mod Title:	Word Cloud
##	Mod Version:	1.0
##	Author:		vgan <transflux@msn.com> (Steve Cvar) http://stevecvar.com
##
##	Description:	Adds a Word Cloud block to your ezPortal. Each word contains a search link that returns topics which contain it.
##			The more often a word has appeared, the larger the font size which will be used to display it.
##			The concept is based on those Tag Clouds you see on everyone's blogs, except that its generated from your word index instead of tags.
##			By default, it displays the 50 most newly mentioned words which have appeared 3 times or more.  
##			These settings can be changed at the top of the mod code in portal.php and will likely need to be tuned a bit for your site.						
##			
##			
##	Compatibility:	2.0.0 - 2.0.22
##
##	Installation Level:	Easy
##	Installation Time:	10 Minutes
##	Files To Edit:		2
##			portal.php
##			templates/subSilver/portal_body.tpl
##
##	History:
##			4-25-2007 - Version 1.0
##				- First Release
##
##	Author Notes:
##		This Mod pulls words from an index of words which appear in ALL forums regardless of a user or groups permissions to access those forums.
##		So, although a user may see words displayed from restricted forums, they will receive a "topic does not exist" error if they click the link.
##
##		The SQL query I use excludes any numbers or words which begin with numbers; otherwise you'd get tons of numbers in your cloud and it's a word cloud, not a number cloud! ;)
##
################################################################################
##
##	Support:      http://www.phpbbhacks.com/forums
##	Copyright:    © 2007 Steve Cvar
##
################################################################################
##
################################################################################
##	Before Adding This MOD To Your Forum,
##	You Should Back Up All Files Related To This MOD
################################################################################

#
#-----[ OPEN portal.php ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#

//
// End session management
//

#
#-----[ AFTER, ADD ]------------------------------------------
#
/////
// 	BEGIN VGAN'S WORD CLOUD MOD
/////

//	Set the minimum count a word must appear before entering the cloud.
$cloud_min = 3;

//	Set the total number of words to display in the cloud.
$cloud_total = 50;

{
$sql = "SELECT phpbb_search_wordlist.word_text, COUNT(phpbb_search_wordmatch.word_id) AS count FROM phpbb_search_wordmatch , phpbb_search_wordlist WHERE phpbb_search_wordmatch.word_id =phpbb_search_wordlist.word_id AND phpbb_search_wordlist.word_text REGEXP '^[a-zA-Z]' GROUP BY phpbb_search_wordmatch.word_id HAVING COUNT(phpbb_search_wordmatch.word_id) >= ". $cloud_min ." ORDER BY phpbb_search_wordmatch.word_id DESC LIMIT 0,". $cloud_total ."";
	if($result = $db->sql_query($sql))
	{
		$cloud_row = $db->sql_fetchrowset($result);
		if (!empty($cloud_row))
		{

			for($j = 0; $j < count($cloud_row); $j++)
			{
				$word_text = $cloud_row[$j]['word_text'];
				$word_count = $cloud_row[$j]['count'];
 
			switch( $cloud_row[$j]['count'])
			{
				case $cloud_min:
					$style_color = 'style="font-size:8px;text-decoration:none;"'; 
					break;
				case $cloud_min + 1:
					$style_color = 'style="font-size:12px;text-decoration:none;"';
					break;
				case $cloud_min + 2:
					$style_color = 'style="font-size:16px;text-decoration:none;"';
					break;
				case $cloud_min + 3:
					$style_color = 'style="font-size:20px;text-decoration:none;"';
					break;
				case $cloud_min + 4:
					$style_color = 'style="font-size:24px;text-decoration:none;"';
					break;
				case $cloud_min + 5:
					$style_color = 'style="font-size:28px;text-decoration:none;"';
					break;
				case $cloud_min + 6:
					$style_color = 'style="font-size:32px;text-decoration:none;"';
					break;
				case $cloud_min + 7:
					$style_color = 'style="font-size:36px;text-decoration:none;"';
					break;
				default:
					$style_color = 'style="font-size:40px;text-decoration:none;"'; 
					break;
			}

			$cloud .= ' <b><a href="' . append_sid("search.$phpEx?mode=results&search_keywords=". $cloud_row[$j]['word_text']) . '"' . $style_color .'title="Appears '. $cloud_row[$j]['count']. ' times">' . $cloud_row[$j]['word_text'] . '</a></b>'; 

			}
			if( empty($cloud_row))
			{
				print 'Sorry, no Cloud for you...';
			}
		}
	}
$db->sql_freeresult($result);
}
/////
////////// END VGAN'S WORD CLOUD MOD
/////

#
#-----[ FIND ]------------------------------------------
#
	'L_VOTE_BUTTON' => $lang['Vote'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
// VGAN'S WORD CLOUD MOD
	'CLOUD' => $cloud,
	'WORD_TEXT' => $word_text[$j],
	'WORD_COUNT' => $word_count[$j],
	'WORD_LINK' => append_sid("search.$phpEx?mode=results&search_keywords=". $word_text[$j]),

#
#-----[ OPEN templates/subSilver/portal_body.tpl ]------------------------------------------
#

#
#-----[ FIND ]------------------------------------------
#
			<input type="hidden" name="mode" value="vote" />
			<!-- END switch_user_logged_in -->
			<br />
		</td>
	   </tr>
	  </table>
	  </form>

	  <br />
#
#-----[ AFTER, ADD ]------------------------------------------
#
	<table width="100%" cellspacing="1" cellpadding="2" border="0" class="forumline">
	 <tr>
		<td class="catHead" height="25"><span class="genmed"><b>Word Cloud</b></span></td>
	 </tr>
	 <tr> 
		<td class="row1">
		{CLOUD}
		<br /><br />
		</td>
	 </tr>
	</table>

	<br />

#
#-----[ SAVE & CLOSE ALL FILES ]--------------------------
#
DAnke tts