$tree = taxonomy_get_tree($vid);
print "<li>"; // 1 line
foreach ($tree as $term) { // 2 lines
$diffdepth=0;
if ($term->depth > $depth) {
print "<ul class='haschild'><li>";
$depth = $term->depth;
}
위의 코드는 원래 $term->depth > $depth
에 따라 출력하고 싶습니다. (print "<li>";
)이 줄. 즉조건 작성 방법은?
,
if ($term->depth > $depth) {
echo '<li class="parent">';
}
else {
print "<li>";
}
하지만 $term->depth
는 foreach 루프 후 사용할 수 있습니다,하지만 난 한 줄을 사용하려면, 어떻게해야합니까?
2 줄의 결과가 나오면 2 라인을 의미합니까? –