taxonomy_term_page
- Versions
- 4.6 – 6
taxonomy_term_page($str_tids= '',$depth= 0,$op= 'page')- 7
taxonomy_term_page($term)
Menu callback; displays all nodes associated with a term.
Parameters
$term The taxonomy term.
Return value
The page content.
Code
modules/taxonomy/taxonomy.pages.inc, line 16
<?php
function taxonomy_term_page($term) {
// Build breadcrumb based on the hierarchy of the term.
$current = (object) array(
'tid' => $term->tid,
);
$breadcrumb = array();
while ($parents = taxonomy_get_parents($current->tid)) {
$current = array_shift($parents);
$breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid);
}
$breadcrumb[] = l(t('Home'), NULL);
$breadcrumb = array_reverse($breadcrumb);
drupal_set_breadcrumb($breadcrumb);
drupal_add_feed(url('taxonomy/term/' . $term->tid . '/feed'), 'RSS - ' . $term->name);
drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
field_attach_prepare_view('taxonomy_term', array($term->tid => $term), 'full');
$build = array();
$build += field_attach_view('taxonomy_term', $term);
$build['term_description'] = array(
'#markup' => check_markup($term->description, $term->format, '', TRUE),
'#weight' => -1,
'#prefix' => '<div class="taxonomy-term-description">',
'#suffix' => '</div>',
);
if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
$nodes = node_load_multiple($nids);
$build += node_build_multiple($nodes);
$build['pager'] = array(
'#markup' => theme('pager', array('tags' => NULL)),
'#weight' => 5,
);
}
else {
$build['no_content'] = array(
'#prefix' => '<p>',
'#markup' => t('There are currently no posts in this category.'),
'#suffix' => '</p>',
);
}
return $build;
}
?>Login or register to post comments 