I'm trying to if else condition inside echo.
<?php if(count($category['children'][$i]['children_level2'])>0){ ?>
<a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?>
<?php echo "<?php if ($direction == 'ltr') { ?><span class='fa fa-caret-right'></span><?php } else { ?><span class='fa fa-caret-left'></span><?php } ?></a>";
} else{ ?>
<a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a>
<?php }?>
but, following condition is not work properly in above code. What is wrong here?
<?php if ($direction == 'ltr') { ?><span class='fa fa-caret-right'></span><?php } else { ?><span class='fa fa-caret-left'></span><?php } ?>