我在创建选定的 php 子菜单类时没有问题,但是当我尝试在子菜单中创建这个子菜单时:我无法让它工作。
问题:由于引号定义echo
内部返回语法错误。echo
<ul class="sub_nav">
<li <?php if ($page=='kurumsal-hakkimizda') {echo "class='selected'";} ?>>
<a href="<?=BAZ_URL?>/tr/kurumsal-hakkimizda">Hakkımızda</a>
</li>
<li <?php if ($page=='kurumsal-ik') {echo "class='selected'";} ?>>
<a href="<?=BAZ_URL?>/tr/kurumsal-ik">İnsan Kaynakları</a>
<?php
if ($page=='kurumsal-ik')
{ echo '
<ul id="sub_sub_nav">
<!-- !! PROBLEM STARTS HERE !! -->
<li class="'if($page=='kurumsal-ik'){echo 'selected'}'">
<!-- !! CANT USE ECHO INSIDE ECHO BEACUSE OF QUOTES !! -->
<a href="'.BAZ_URL.'/tr/kurumsal-ik">İnsan Kaynakları Politikamız</a>
</li>
<li class="'if($page=='kurumsal-hedef'){echo 'selected'}'">
<a href="'.BAZ_URL.'/tr/kurumsal-hedef">Kurumsal Hedef</a>
</li>
</ul>
';}
?>
</li>
<li <?php if ($page=='kurumsal-haberler') {echo "class='selected'";} ?>>
<a href="<?=BAZ_URL?>/tr/kurumsal-haberler">Kurumsal Haberler</a>
</li>
</ul>