Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Author Topic: Sorting keywords by usage  (Read 3248 times)

centered

  • Guest
Sorting keywords by usage
« on: June 13, 2007, 02:31:22 PM »

Referencing this mod: http://www.solucija.com/forum/viewtopic.php?id=2974

:(

The problem is if you have multiple keywords that are identical.  I would like to have php sort them out and add a wieght, if you will, to the ones that are duplicated.

I could use some help...

http://www.scriptplayground.com/tutorials/php/Tag-Cloud/
http://www.hawkee.com/snippet/1485/

These are not working as I expected them to...
Code: [Select]
// TAGS
function getTags () {
    connect_to_db();
    $db = new Database(s('dbname'));
    $query = "SELECT * FROM " .s('prefix'). "articles WHERE published = 1";          
    $result = $db->query($query);
    while ($r = $result->fetch_array()) {
        $labels = explode(',', $r['keywords_meta']);
$arr = $labels;
}
// Something needs to go in here!!!!
  ksort($arr);

$min_font_size = 12;
$max_font_size = 30;
$tag = ksort($arr);
            foreach ($tag as $tag) {
                if($labels == '') break;
                srand ((double) microtime( )*1000000);
                $tagnum = (rand()%5);
                $tag = trim($tag);
                echo ''.$tag.' ';
            }

//    }
}
Logged

centered

  • Guest
Sorting keywords by usage
« Reply #1 on: June 13, 2007, 04:25:04 PM »

I think i need a
for $i, $i = 1 giving a number to the data
then $arr = $labels[$i]
then array_merge to combine like items?

Maybe?
Logged

centered

  • Guest
Sorting keywords by usage
« Reply #2 on: June 14, 2007, 02:06:16 AM »

Solved
Logged