<?php
print '';
$tids = array();
$res= db_query("SELECT term_data.tid AS tid,
CONCAT(SUBSTRING(REPLACE(term_data.name, 'Аўтар невядомы', 'невядомы Аўтар'), LOCATE(' ', REPLACE(term_data.name, 'Аўтар невядомы', 'невядомы Аўтар')) + 1), ' ', SUBSTRING(REPLACE(term_data.name, 'Аўтар невядомы', 'невядомы Аўтар'), 1, LOCATE(' ', REPLACE(term_data.name, 'Аўтар невядомы', 'невядомы Аўтар')) - 1)) AS term_data_name,
CONCAT(SUBSTRING(REPLACE(REPLACE(term_data.name, 'І', 'И'), 'Аўтар невядомы', '.'), LOCATE(' ', term_data.name) + 1), ' ', SUBSTRING(term_data.name, 1, LOCATE(' ', term_data.name) - 1)) AS my_sort
FROM {term_data} term_data
WHERE term_data.vid = 1
and 2 < (select count(*) from {term_node} where {term_node}.tid = term_data.tid)
ORDER BY term_data.weight ASC, my_sort ASC");
//SELECT tid, name FROM {term_data} WHERE vid = 2 ORDER BY weight, name");
while ($term = db_fetch_object($res)) {
$tids[$term->tid] = $term->term_data_name;
}
$counter = 0;
$linescount = 0;
foreach ($tids as $tid => $name)
{
$counter++;
if ($counter%3==1){
$linescount++;
if ($linescount > 4) break;
print '';
}
print '';
print ''.l($name, 'taxonomy/term/'.$tid, array()).'';
print '';
if ($tid == 13 || $tid == 14 || $tid == 15 )
{
echo '';
}
$nodes_res = taxonomy_select_nodes(array($tid));
$node_counter = 0;
while ($node = db_fetch_object($nodes_res))
{
$node = node_load($node->nid);
print ''.l($node->title, 'node/'.$node->nid, array()).'';
// print ''.node_view($node, true).'';
if (++$node_counter > 2) break;
}
print ''.l('Яшчэ...', 'taxonomy/term/'.$tid, array()).'';
print '';
print '';
if ($counter%3==0) print '';
}
print '';
?>