[BETA] phpBB Wordgraph MOD

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
ToonArmy
Former Team Member
Posts: 4608
Joined: Sat Mar 06, 2004 5:29 pm
Location: Worcestershire, UK
Name: Chris Smith
Contact:

Post by ToonArmy »

pentapenguin, nice mod - I spotted a few places where you could optimise though :D Note: I have not tested these changes out so please ensure they are sane ;)

wordgraph.php

Find:

Code: Select all

while ( $row = $db->sql_fetchrow($result) )
{
	$word = strtolower($row['word_text']);
	$word_count = $row['word_count'];

	$words_array[$word] = $word_count;

}
Replace With:

Code: Select all

while ( $row = $db->sql_fetchrow($result) )
{
	/**
	 * No need to use strtolower() because words are stored
	 * in the lowercase form.
	 */
	$words_array[$row['word_text']] = $row['word_count'];
}
Find:

Code: Select all

$minimum = 1000000;
$maximum = -1000000;

foreach ( array_keys($words_array) as $word )
{
	if ( $words_array[$word] > $maximum )
	{
		$maximum = $words_array[$word];
	}

	if ( $words_array[$word] < $minimum )
	{
		$minimum = $words_array[$word];
	}
}

$ratio = 18.0 / ( $maximum - $minimum);
Replace With:

Code: Select all

$ratio = 18.0 / ( max($words_array) - min($words_array) );
Yes! One line ;)

Find:

Code: Select all

$words = array_keys($words_array);
sort($words);

foreach ( $words as $word )
Replace With:

Code: Select all

ksort($words_array);

foreach ( $words_array as $word => $count )
Avoids creating another potentially huge array.

Find:

Code: Select all

'WORD' => ( $board_config['word_graph_word_counts'] ) ? $word . ' (' . $words_array[$word] . ')' : $word,
Inline Find:

Code: Select all

$words_array[$word]
Replace With:

Code: Select all

$count
Optional but why not ;)

Find:

Code: Select all

'WORD_FONT_SIZE' => (int) ( 9 + ( $words_array[$word] * $ratio ) ),
Inline Find:

Code: Select all

$words_array[$word]
Replace With:

Code: Select all

$count
Optional again but why not ;)

That is all.
Chris SmithGitHub
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Post by pentapenguin »

ToonArmy wrote: pentapenguin, nice mod - I spotted a few places where you could optimise though :D Note: I have not tested these changes out so please ensure they are sane ;)

Heh...it's 2am here so I can't verify those right now, but thanks a lot for the tips! I will certainly check to make sure they work, and if they do, I will be sure to give you credit. :)
daniela22 wrote: Hello, is there any way to exclude the words from the "search_stopwords.txt"?

To be honest, I have no idea if it this does or does not exclude those words. I will check on this though.
yofx wrote: Okay, I got the wordgraph to display on the search page, instead or addition to the seperate wordgraph.php page.

Good idea but I don't think I will probably make the main MOD that way since it would be a bit harder to install. However, I might include your idea as a "add-on" giving you credit. Good idea to put it on the search page. :)

Okay folks, other than the ideas above and making a admin control panel option to use the built-in forum search or an external search engine (e.g. Google, MSN, Yahoo, Ask, etc.), does anyone have any more ideas for this MOD? I hope to get it finished up soon and submitted to the MODDB. Thanks!!!! :D
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
dcz
Registered User
Posts: 787
Joined: Sun Feb 13, 2005 5:37 am
Contact:

Post by dcz »

daniela22 wrote: Hello, is there any way to exclude the words from the "search_stopwords.txt"?

They are filtered if the search tables are up to date.
This mean updating your search_stopwords.txt will be of no effect if you don't take care of the previous entries.

To do this two solutions : http://www.phpbb.com/phpBB/viewtopic.php?t=329629

and http://www.phpbb.com/kb/article.php?article_id=30

The first one (rebuild search) is heavier to run but worth it IMHO.

++

phpBB SEO || phpBB3 SEO Premod || SEO phpBB3
GYM Sitemaps & RSS for phpBB3: GYM Sitemaps & RSS
kulinar
Registered User
Posts: 657
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Re: [BETA] phpBB Wordgraph MOD

Post by kulinar »

I have a suggestion and a question.

1. Remove smilies words from wordlist otherwise you get this.

2. Why all my words are the same font size?
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Re: [BETA] phpBB Wordgraph MOD

Post by pentapenguin »

Thank you for the suggestion, kulinar. As for your problem, are you using the latest version?
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
kulinar
Registered User
Posts: 657
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Re: [BETA] phpBB Wordgraph MOD

Post by kulinar »

I downloaded the file from sf.net (the link in first post). I guess version 0.1.0 :roll:
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Re: [BETA] phpBB Wordgraph MOD

Post by pentapenguin »

kulinar wrote: I downloaded the file from sf.net (the link in first post). I guess version 0.1.0 :roll:

Oh that is the latest version then from SourceForge. I'll look into your problem later. Please PM and remind me if I forget. :)
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
kulinar
Registered User
Posts: 657
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Re: [BETA] phpBB Wordgraph MOD

Post by kulinar »

OK. I just wanted to let you know that I use extreme styles mod.
kulinar
Registered User
Posts: 657
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Re: [BETA] phpBB Wordgraph MOD

Post by kulinar »

Thanks to a guy from my country I resolved the problem. I use xhtml transitional instead of html 4.01 transitional. That why I had to do:

Code: Select all

OPEN
wordgraph_body.tpl

FIND
			<span style="font-size: {wordgraph_loop.WORD_FONT_SIZE}">

REPLACE WITH

			<span style="font-size: {wordgraph_loop.WORD_FONT_SIZE}pt">
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Re: [BETA] phpBB Wordgraph MOD

Post by pentapenguin »

No that's definitely a bug with this MOD. It should always have a unit (pt) with the size. Thanks for finding it!
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
kulinar
Registered User
Posts: 657
Joined: Thu Feb 17, 2005 7:31 pm
Contact:

Re: [BETA] phpBB Wordgraph MOD

Post by kulinar »

You are welcome! As we speek about bugs: Install file should be changed as

Code: Select all

#
#-----[ FIND ]------------------------------------------
#
			$cookie_name = str_replace('.', '_', $new['cookie_name']);
		}

#
#-----[ REPLACE WITH ]------------------------------------------
#
			$new['cookie_name'] = str_replace('.', '_', $new['cookie_name']);
		}
User avatar
pentapenguin
Former Team Member
Posts: 11030
Joined: Thu Jul 01, 2004 4:15 am
Location: GA, USA

Re: [BETA] phpBB Wordgraph MOD

Post by pentapenguin »

Thank you again. I will try to get a new release out soon. :)
Support Resources: Support Request Template
If you need professional assistance with your board, please contact me for my reasonable rates.
User avatar
likepassion
Registered User
Posts: 3
Joined: Wed Feb 28, 2007 4:21 pm
Location: Italy
Contact:

Re: [BETA] phpBB Wordgraph MOD

Post by likepassion »

hi!

i've just installed correctly this mod (you can find it on : http://www.ballarelatino.com/wordgraph.php) but i've 2 questions :

1.is possible to filter the nick of the users and the smilies (the first 2 words are "lol" and "quot"...) ?
2.is possible to put them on the index body ?

Thanks a lot everybody!
cunyalen
Registered User
Posts: 127
Joined: Sat Jul 14, 2007 9:09 pm

Re: [BETA] phpBB Wordgraph MOD

Post by cunyalen »

Is this working for phpbb3?
User avatar
Lisbon
Registered User
Posts: 831
Joined: Wed Jan 30, 2008 12:28 pm
Location: Zermatt

Re: [BETA] phpBB Wordgraph MOD

Post by Lisbon »

Theres a similar mod for phpbb3...????
Post Reply

Return to “[2.0.x] MODs in Development”