On multilingual site
I couldnt use it with the full url path at first because /en/taxonomy/term/10 when 10 is an english lang taxonomy like "movies" works well but if someone switches language to hu (hungarian) then same link shows zero nodes in it cos there are no hungarian articles in the english category "movies" since they are in the hung. cat. "film" - so basically it means that I need to add 2 different url paths to different languages with a different language tag. I have no ide about php code, so its maybe wrong but what i did was copy-pasting functions and add a number 2 to everything in the second, and then made 2 different, language-limited output. Like this:
<?php
function getNodeCount($tid) {
$sql = "select count(1) as num"
. " from term_node"
. " where tid = $tid";
return ($acount = db_fetch_object(db_query($sql)))? $acount->num : 0;
}
function getNodeCount2($tid2) {
$sql2 = "select count(1) as num"
. " from term_node"
. " where tid = $tid2";
return ($acount2 = db_fetch_object(db_query($sql2)))? $acount2->num : 0;
}
function getChildTerms($parent, $vid) {
$sql = "select td.tid, td.vid, td.name"
. " from term_data td"
. " join term_hierarchy th on th.tid = td.tid"
. " where th.parent = $parent"
. " and td.vid = $vid"
. " order by td.weight, td.name";
$terms = db_query($sql);
$output = "";
while ($aterm = db_fetch_object($terms)) {
$output .= "<li><a href='http://www.example.com/taxonomy/term/$aterm->tid/0/feed'><img src='http://www.example.com/misc/feed.png' border='0' alt='feed' title='Feed de $aterm->name' /></a> "
. "<a href='http://www.example.com/hu/taxonomy/term/$aterm->tid'>$aterm->name</a> ("
. getNodeCount($aterm->tid) . ")</li>\n"
. getChildTerms($aterm->tid, $vid);
}
return ($output != "")? "<ul>\n" . $output . "</ul>\n" : "";
}
function getChildTerms2($parent2, $vid2) {
$sql2 = "select td.tid, td.vid, td.name"
. " from term_data td"
. " join term_hierarchy th on th.tid = td.tid"
. " where th.parent = $parent2"
. " and td.vid = $vid2"
. " order by td.weight, td.name";
$terms2 = db_query($sql2);
$output2 = "";
while ($aterm2 = db_fetch_object($terms2)) {
$output2 .= "<li><a href='http://www.example.com/taxonomy/term/$aterm2->tid/0/feed'><img src='http://www.example.com/misc/feed.png' border='0' alt='feed' title='Feed de $aterm2->name' /></a> "
. "<a href='http://www.example.com/en/taxonomy/term/$aterm->tid'>$aterm2->name</a> ("
. getNodeCount($aterm2->tid) . ")</li>\n"
. getChildTerms($aterm2->tid, $vid2);
}
return ($output2 != "")? "<ul>\n" . $output2 . "</ul>\n" : "";
}
$sql = "select vid, name from vocabulary where (name NOT in ('Forums')) AND (language NOT in ('en')) order by name";
$vocabularies = db_query($sql);
$output = "";
while ($avoc = db_fetch_object($vocabularies)) {
$output .= "<li><strong>$avoc->name</strong></li>\n"
. getChildTerms(0, $avoc->vid);
}
$sql2 = "select vid, name from vocabulary where (name NOT in ('Forums')) AND (language NOT in ('hu')) order by name";
$vocabularies2 = db_query($sql2);
$output2 = "";
while ($avoc2 = db_fetch_object($vocabularies2)) {
$output2 .= "<li><strong>$avoc2->name</strong></li>\n"
. getChildTerms2(0, $avoc2->vid);
}
print "<div class='taxonomy_tree'><p><ul>\n" . $output2 . "</ul></p></div>\n";
print "<div class='taxonomy_tree'><p><ul>\n" . $output . "</ul></p></div>\n";
?>it works..
(If someone has no-language containers and multilingual, translated terms in them then I dont know what's the solution but that set-up didn't work for me.)
By the way, the feed icon has a different name in new sites or in different themes, so ppl need to find the url of their own icon. Another thing, the original code had the word 'forum' and my 4.7 drupal with 4.1 mysql made a table named 'Forums'.
