hi guys,
please someone help me....
i think i found a solution to show a tagcloud for tags by user and node-type
$result = db_query("select m.tid,m.name,count(n.nid) AS nodecount from {term_data} m right join {term_node} t on m.tid=t.tid right join {node} n on n.nid=t.nid where n.uid=%d and n.type='blog' group by t.tid ORDER BY m.name ASC", $node->uid);
//the above code semms working but what to do now? i tryd the following:
drupal_set_html_head('<style type="text/css">@import url('.drupal_get_path('module','tagadelic').'/tagadelic.css);</style>');
$tags = tagadelic_build_weighted_tags($result);
$output = theme('tagadelic_weighted',tagadelic_get_weighted_tags($tags));
print $output;
this not work, what is the right solution?
regards
Lausch
Comments
Comment #1
d0t101101 commentedHi Lausch,
Actually, your code is partially working for me. I changed the node type to find nodes I already have, got a themed list of tags from vocabulary 1. The strange thing is, running the SQL statement directly, it returned a list from all vocabs, not only the first....
Not positive, but I think you might need to change the format of the result data to more closely match tagadelic_get_weighted_tags, which uses the following SQL query (looking at the tagadelic.module code):
I'm not a DB guy, but from what I've gathered you should use INNER JOIN's if possible for performance. Also doing a JOIN on the node table could seriously bog down a site with a lot of content...
I'm currently using views_tagadelic to filter the tags by user, and it works well. Time will tell how 'expensive' it is, as the node table grows...
Best regards,
.
Comment #2
Bèr Kessels commentedFirst, .you need a vid. I know, ugly, but just adding
0 as vidshould work.More importantly is that you ned "count", not "nodecount".
"select m.tid, 0 as vid, m.name, count(n.nid) as count from {term_data} m right join {term_node} t on m.tid=t.tid right join {node} n on n.nid=t.nid where n.uid=%d and n.type='blog' group by t.tid ORDER BY m.name ASCComment #3
Bèr Kessels commentedno feedback