logo

Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

Theming the taxonomy catalog

22/02/2025, by Anonymous (not verified)

Hello, could you please tell me who has dealt with taxonomy theming? I have a standard product catalog where the section image is displayed first, followed by the section name and then the list of child terms. I need to change the order... specifically, I want the section name to be displayed first, then the image, and finally the list of terms (subsections)... In views, I am using the following code to display the terms:

 

<?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;

}

?>

 

It seems simple enough, but apparently I'm not very good at PHP, and I don't understand what '$item =' and '$item .=' mean, what does that dot signify? :) Thank you in advance...