$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->depthforeachループの後に使えますが、1行で使いたいのですがどうすればいいですか?