hi everyone,
the below code works.
<?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 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 .= "
tid/0/feed'> "
. "tid'>$aterm->name ("
. getNodeCount($aterm->tid).")
\n"
. getChildTerms($aterm->tid, $vid);
}
return ($output != "")? "
\n" : "";
}
$sql = "select vid, name from vocabulary where name in ('directory', 'shopping') order by name";
$vocabularies = db_query($sql);
$output = "";
while ($avoc = db_fetch_object($vocabularies))
{
$output .= "
$avoc->name
\n"
. getChildTerms(0, $avoc->vid);
}