Drupal 如何添加寻呼机或如何限制术语“分类法”和“获取树($vid)”?

Drupal 如何添加寻呼机或如何限制术语“分类法”和“获取树($vid)”?,drupal,tree,taxonomy,Drupal,Tree,Taxonomy,使用分类法\u get\u tree($vid)时,如何使用寻呼机或如何限制术语 我有以下术语生成代码: <?php $vid = 2; $terms = taxonomy_get_tree($vid); $max_depth = (!isset($max_depth)) ? count($children[$vid]) : $max_depth; foreach ($terms as $term) { if ($term->depth == 0) { print ""

使用
分类法\u get\u tree($vid)
时,如何使用寻呼机或如何限制术语

我有以下术语生成代码:

<?php
$vid = 2;
$terms = taxonomy_get_tree($vid);   
$max_depth = (!isset($max_depth)) ? count($children[$vid]) : $max_depth;

foreach ($terms as $term) {
if ($term->depth == 0) 
{  
print "" .l("<b>Auto Insurance for &nbsp;</b> " .$term->name,'taxonomy/term/'.$term->tid, array('attributes' => array('title' => $term->name, ), 'html' => TRUE) ). "";

}}

?>

但是有成千上万的术语或子术语。一些页面加载时间超过20秒。我需要改善这种情况


你能给我一些建议吗?你知道一些解决办法吗?Pager、Jquery、Ajax?

获取当前页面的术语

$query = db_select('taxonomy_term_data', 'td')
  ->extend('PagerDefault')
  ->condition('td.vid', $vid)
  ->fields('td', array('tid'))
  ->orderBy('td.weight')
  ->limit($limit);
$query->join('taxonomy_term_hierarchy', 'th', 'td.tid = %alias.tid AND %alias.parent = 0');
$tids = $query->execute()->fetchAllKeyed(0,0);
$terms = entity_load('taxonomy_term', $tids);
显示寻呼机

theme('pager');

嗨,谢谢你的回答,但是…这个代码到底放在哪里?