タクソノミーカタログのテーマ化
こんにちは、タクソノミーのテーマ化に取り組んだことがある方に教えていただきたいです。通常の商品カタログがあり、標準では区分の画像、次に区分名、そして子タームの一覧が表示されます。この順序を変更したいのです...具体的には、最初に区分名、次に画像、その後にターム(サブ区分)の一覧という順番にしたいです...Viewsではタームを出力するために以下のコードを使っています:
<?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 .='が何を意味するのか理解できません、あのピリオドが何なのか分かりません :) よろしくお願いします...
- コメントを投稿するにはログインしてください