Создание баннеров
<?php
//Вывод последних нод из определенной ветви таксономии
$term_id = 67; //термин 'фирменный стиль'
$vid = 8;//ИД Словаря
$cnt = 9; // Сколько на страницу
if ($_GET['q']!='node/137') {
return;// защита php-кода этой ноды от индексации в поиске по крону
}
$old_cnt = variable_get('default_nodes_main', 10);
$GLOBALS['conf']['default_nodes_main']=$cnt;
$tree = taxonomy_get_tree($vid,0,-1,3);
foreach ($tree as $idx => $term) {
if ($term->tid!=$term_id && !in_array($term_id,$term->parents)) {
unset($tree[$idx]);
}
}
if ($r = (taxonomy_select_nodes(array_map('_taxonomy_get_tid_from_term', $tree), 'or', 'all'))) {
$i=0;
$clear_opened = false;
while ($node = db_fetch_object($r)) {
if ($node=node_load($node->nid)) {
if ($i == 0) {
$clear_opened = TRUE;
echo $i==0 ? '
}
$teaser_file =
$node->field_teaser_flash[0]['filepath'] ?
'
'
: ($node->images['_original'] ? 'nid).'">'.theme('imagecache','156x156',$node->images['_original'],$node->title,$node->title).'' : '' );
echo '
';
if ($i == 2) {
$clear_opened = FALSE;
echo '
';
}
$i++;
if ($i>=3) {
$i=0;
}
}
}
if ($clear_opened) {
echo '
';
}
echo theme('pager',NULL, $cnt, 0);
}
$GLOBALS['conf']['default_nodes_main']=$old_cnt;
?>






