logo

额外区块类型 (EBT) - 全新的布局构建器体验❗

额外区块类型 (EBT) - 样式化、可定制的区块类型:幻灯片、标签页、卡片、手风琴等更多类型。内置背景、DOM Box、JavaScript 插件的设置。立即体验布局构建的未来。

演示 EBT 模块 下载 EBT 模块

❗额外段落类型 (EPT) - 全新的 Paragraphs 体验

额外段落类型 (EPT) - 类似的基于 Paragraph 的模块集合。

演示 EPT 模块 滚动

滚动

分类目录的主题化

22/02/2025, by 匿名 (未验证)

您好,请问一下谁遇到过分类法的主题化问题,我有一个普通的产品目录,按照标准显示的是分类的图片,然后是分类的名称,最后是子术语的列表。我需要更改顺序……也就是说,首先显示分类的名称,然后是图片,最后是术语(子分类)的列表……在视图中我使用以下代码来输出术语:

 

<?php

$vid = 4;

$cols = 1;

$limit = 5000;

 

$tree = taxonomy_get_tree($vid, 0, -1, 1);

if (!empty($tree)) {

  $output = '<table class="catalog-root">';

  $count = 0;

  $total = count($tree);

  

  foreach ($tree as $tid => $term) {

    if ($count % $cols == 0) {

      $output .= '<tr>';

    }

 

$item = '<center>'.l(taxonomy_image_display($term->tid), taxonomy_term_path($term),array('html' => TRUE)).'</a></BR>';

$item .= '<strong><font style="font-size:25px; font-family: verdana;">'.l($term->name, taxonomy_term_path($term)).'</font></strong><BR>';

 

    $children_list = array();

    $children = taxonomy_get_children($term->tid, $vid);

    $i = 1;

    foreach (taxonomy_get_children($term->tid, $vid) as $child) {

      $children_list[] = l($child->name, taxonomy_term_path($child));

      if ($limit != 0 && $i >= $limit) break;

      $i++;

    }

    if (count($children) > $limit) {

      $children_list[] = l('...', taxonomy_term_path($term));

    }

    $count++;

    $item .= implode(' <br> ', $children_list);

    $output .= '<td align="center">'. $item .'</td>';

    if ($count % $cols == 0 || $count == $total) {

      $output .= '</tr>';

    }

  }

  $output .= '</table>';

  

  return $output;

}

?>

 

看起来很简单,但显然我对PHP不太熟悉,我不明白'$item ='和'$item .='中的点是什么意思 :) 提前谢谢您……